Thread overview
Makefiles and dub
Nov 04, 2022
Anonymouse
Nov 04, 2022
H. S. Teoh
Nov 05, 2022
rikki cattermole
Nov 05, 2022
Imperatorn
Nov 05, 2022
rikki cattermole
Nov 05, 2022
Guillaume Piolat
Nov 05, 2022
Christian Köstlin
Nov 08, 2022
Mathias LANG
November 04, 2022

#20699 must be non-trivial to fix, so I'm exploring makefiles. If possible I'd like to keep dub for dependency management though, just not for actual compilation.

Is it at all possible (or even desireable) to construct a makefile that builds dependencies from outside of the source tree (namely $HOME/.dub/packages/package_with_unknown_version-1.2.[0-9]+/)?

Does anyone have an example Makefile I could dissect?

Thanks.

November 04, 2022
On Fri, Nov 04, 2022 at 11:19:17PM +0000, Anonymouse via Digitalmars-d-learn wrote:
> [#20699](https://issues.dlang.org/show_bug.cgi?id=20699) must be non-trivial to fix, so I'm exploring makefiles. If possible I'd like to keep dub for dependency management though, just not for actual compilation.
> 
> Is it at all possible (or even desireable) to construct a makefile
> that builds dependencies from outside of the source tree (namely
> `$HOME/.dub/packages/package_with_unknown_version-1.2.[0-9]+/`)?
> 
> Does anyone have an example `Makefile` I could dissect?
[...]

Don't have a Makefile to show, but I've done the following in the past when I have dub dependencies but need to use my own build system:

- Create a subdirectory containing a dummy empty dub project (containing
  nothing but an empty main()), whose sole purpose is to declare dub
  dependencies that I need.
- Run dub to retrieve and compile said dependencies, with --vverbose so
  that shows the actual compile commands (for extracting the pathnames
  of the compiled artifacts).
- Copy-n-paste the compiled objects paths into my build system as object
  files / libraries to link against.

In theory, the second step above can be automatically parsed to extract the needed paths, or even recompile after altering the command-line options, but I never got that far because I've since shelved the project (for reasons unrelated to dub).


T

-- 
Holding a grudge is like drinking poison and hoping the other person dies. -- seen on the 'Net
November 04, 2022

On 11/4/22 7:19 PM, Anonymouse wrote:

>

#20699 must be non-trivial to fix, so I'm exploring makefiles. If possible I'd like to keep dub for dependency management though, just not for actual compilation.

Is it at all possible (or even desireable) to construct a makefile that builds dependencies from outside of the source tree (namely $HOME/.dub/packages/package_with_unknown_version-1.2.[0-9]+/)?

Does anyone have an example Makefile I could dissect?

Thanks.

dub describe can give you probably enough information to build a makefile.

And I believe it should do all the dependency fetching when you call it.

-Steve

November 06, 2022
We have a few build formats that dub can generate for you automatically:

```
visuald - VisualD project files
sublimetext - SublimeText project file
cmake - CMake build scripts
build - Builds the package directly
```

Unfortunately none of them are make, it would be nice to have that if you are looking to contribute!
November 05, 2022
On Saturday, 5 November 2022 at 11:38:09 UTC, rikki cattermole wrote:
> We have a few build formats that dub can generate for you automatically:
>
> ```
> visuald - VisualD project files
> sublimetext - SublimeText project file
> cmake - CMake build scripts
> build - Builds the package directly
> ```
>
> Unfortunately none of them are make, it would be nice to have that if you are looking to contribute!

Wait, dub can generate all those? I only knew about visuald
November 06, 2022
On 06/11/2022 1:16 AM, Imperatorn wrote:
> On Saturday, 5 November 2022 at 11:38:09 UTC, rikki cattermole wrote:
>> We have a few build formats that dub can generate for you automatically:
>>
>> ```
>> visuald - VisualD project files
>> sublimetext - SublimeText project file
>> cmake - CMake build scripts
>> build - Builds the package directly
>> ```
>>
>> Unfortunately none of them are make, it would be nice to have that if you are looking to contribute!
> 
> Wait, dub can generate all those? I only knew about visuald

build is just dub and doesn't emit any project files.

But yes, it has two others (although idk how much they get used, or how complete).
November 05, 2022
On 05.11.22 12:38, rikki cattermole wrote:
> We have a few build formats that dub can generate for you automatically:
> 
> ```
> visuald - VisualD project files
> sublimetext - SublimeText project file
> cmake - CMake build scripts
> build - Builds the package directly
> ```
> 
> Unfortunately none of them are make, it would be nice to have that if you are looking to contribute!
If cmake works, then cmake could generate a normal makefile :)

Kind regards,
Christian

November 05, 2022
On Saturday, 5 November 2022 at 12:17:14 UTC, rikki cattermole wrote:
>
> But yes, it has two others (although idk how much they get used, or how complete).


Using the first two all the time.
IIRC VisualD projects respect --combined


November 08, 2022

On Friday, 4 November 2022 at 23:19:17 UTC, Anonymouse wrote:

>

#20699 must be non-trivial to fix, so I'm exploring makefiles. If possible I'd like to keep dub for dependency management though, just not for actual compilation.

That bug is fixed for the last 3 releases (not including the current one in progress), that is, since v1.26.0.

>

Is it at all possible (or even desireable) to construct a makefile that builds dependencies from outside of the source tree (namely $HOME/.dub/packages/package_with_unknown_version-1.2.[0-9]+/)?

Does anyone have an example Makefile I could dissect?

Thanks.

In the past, I used https://github.com/sociomantic-tsunami/makd for building D code.
But it doesn't do dependency management like dub, as it expected libraries to be in submodules/.