[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

target specific variables in makefiles



I have a source package that creates multiple binary packages, each of which
requires a different sequence of debhelper programs.  To avoid having to
specify the -p option for each command, I do this:

pkg1-stamp: pkg1
pkg2-stamp: pkg2

%-stamp:
	$(MAKE) -f debian/rules DH_OPTIONS=-p$(@:%-stamp=%) $(@:%-stamp=%)
	touch $@

pkg1:
	...
	dh_install
	dh_installxfonts
	...

pkg2:
	...
	dh_install
	dh_installemacsen
	...

I recently read about target-specific variables in make, so I thought I could
do this:

pkg1-stamp: pkg1
pkg2-stamp: pkg2

%-stamp: $(@:%-stamp=%)
	touch $@

pkg1: DH_OPTIONS=-p$@
	...
	dh_install
	dh_installxfonts
	...

pkg2: DH_OPTIONS=-p$@
	...
	dh_install
	dh_installemacsen
	...

and avoid the extra call to make, but I get an error:
"*** commands commence before first target.  Stop."
Can someone tell me how to use target-specific make variables?

Thanks.

-- 
Neil Roeth



Reply to: