dmake target specific variables

61 Views Asked by At

This topic has been discussed a few times, but the answers only seem to cover GNU make. For this particular Makefile, I'd like it to be a single cross-platform file assuming GNU make for Mac and Linux, and dmake for Windows.

I'm trying to figure out how to assign macros/variables for only a specified target using dmake. In this case, I'm going to use it for preprocessor definitions.

I'd like to add

CPPFLAGS += -DINITIAL

to an 'initial' target and

CPPFLAGS += -DUPDATE

to an 'update' target.

Using GNU make, we can achieve this by the following:

initial: CPPFLAGS += -DINITIAL
initial:
        ...

update: CPPFLAGS += -DUPDATE
update:
        ...

but unfortunately, it breaks the build using dmake.

1

There are 1 best solutions below

0
On BEST ANSWER

Using dmake, the syntax needs to be slightly changed to

initial ?= CPPFLAGS += -DINITIAL

Resource: http://www.openoffice.org/tools/dmake/dmake_4.3.html#lbAS

Wrapping the different syntaxes in OS checks allows for a cohesive Makefile .