www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Makefiles and dub

reply Anonymouse <zorael gmail.com> writes:
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?

Thanks.
Nov 04 2022
next sibling parent "H. S. Teoh" <hsteoh qfbox.info> writes:
On Fri, Nov 04, 2022 at 11:19:17PM +0000, Anonymouse via Digitalmars-d-learn
wrote:
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
Nov 04 2022
prev sibling next sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 11/4/22 7:19 PM, Anonymouse wrote:
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?
 
 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
Nov 04 2022
prev sibling next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
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!
Nov 05 2022
next sibling parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
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
Nov 05 2022
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
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).
Nov 05 2022
parent Guillaume Piolat <first.last spam.org> writes:
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
Nov 05 2022
prev sibling parent =?UTF-8?Q?Christian_K=c3=b6stlin?= <christian.koestlin gmail.com> writes:
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
Nov 05 2022
prev sibling parent Mathias LANG <geod24 gmail.com> writes:
On Friday, 4 November 2022 at 23:19:17 UTC, Anonymouse wrote:
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.
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/`.
Nov 08 2022