[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
generating multiple object files -- the current solution
From: |
Robert P. J. Day |
Subject: |
generating multiple object files -- the current solution |
Date: |
Tue, 28 Mar 2006 13:32:00 -0500 (EST) |
based on the last couple of replies here (thanks muchly), here's the
solution i came up with:
=========================================
define gen-obj-names
$(addsuffix .o,$(sort $(shell grep -h "^\#ifdef L_" ${1} | sed -e "s/^\#ifdef
L_"//)))
endef
define multisrc-rule-template
$(call gen-obj-names,${1}) : ${1}
gcc -DL_$$(basename $$@) $$< -o $$@
endef
MULTISRCS := $(shell grep -l "^\#ifdef L_" $(wildcard *.c))
$(foreach src,${MULTISRCS},$(eval $(call multisrc-rule-template,${src})))
=========================================
the only problem, though, is that someone suggested that invoking a
"call" from within an "eval" is not guaranteed to work in make-3.80
and earlier versions.
is there anything about the above that could cause problems in older
versions of make? if there is, then it's not really a usable solution
for me. thanks.
rday
- generating multiple object files -- the current solution,
Robert P. J. Day <=