How do i convert this Makefile to dub

Adil via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 8 11:29:54 PDT 2016


I have a Makefile setup that I use to return the latest git 
tag/commit from within my program. The setup is as below:


````
VERSIONED_LIB = myversion.d && rm -f myversion.d
VERSION_STRING ?= $(shell git rev-parse --short HEAD)

makeVersion:
	echo "module compileConfig; public string versionString = 
\"$(VERSION_STRING)\";" > myversion.d;

mysoftware: makeVersion
	dmd -de -O /* compiler flags */ source/myprogrma.d myversion.d
	rm -f myversion.d
````

When i run `make mysoftware` my binary now contains the latest 
git commit HASH, which i use for debugging.

How can i mimic the same setup i dub? Is there an alternative to 
achieve the same goal?


More information about the Digitalmars-d-learn mailing list