[Top][All Lists]

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

forcing make action independent from specified target?

From: gert . geurts
Subject: forcing make action independent from specified target?
Date: Fri, 29 Oct 2004 16:04:14 +0200


Hope this email address is still valid...
I'm wondering if the following problem can be solved neatly.
I've a Makefile with several targets. (a barebone version included
at the end of this email). All targets are used
to build something (object, executable) except for
the targets 'clean, cleanall' (not included here).
What I would like to happen is that gmake always checks out
all include files specified in $(APS_INCLUDES) that are not
checked out yet before trying to build anything else, when the target
is not defined as clean or cleanall. I would guess that this
should be possible without calling gmake recursively, but I
don't see how. I tried several things:
- overriding MAKECMDGOALS. It would do the job:
  but overriding this variable is not ineffective.

- setting MAKEFLAGS in the Makefile:
  MAKEFLAGS := $(MAKEFLAGS -o coinc)
  and declare sources to depend on coinc.
  Reading the manual a bit better revealed that
  -o is one of the options that cannot be used.
  (I don't want to put it in a script, or have users
   call gmake with the options on the command line.
   I'm interested in a pure -nonrecursive- gmake solution.)

Another way could have been using a .FORCETARGET directive,
to indicate that a target defined here should always be made first.
Using it in a 'ifeq ....' construct could define this directive conditionally.

Hope this is clear enough...
Am I overlooking something, or is it really hard to implement this?

Thanks for every pointer you can give me,

    Gert Geurts


.PHONY: all coinc


coinc: $(APS_INCLUDES)

$(APS_INC_PATH)/%.h : $(APS_INC_PATH)/RCS/%.h,v
        $(CO) $(COFLAGS) $< $@

$(MY_OBJ_PATH)/%.o : $(MY_SRC_PATH)/%.c
        echo "---- COMPILING for $(OSTYPE) to $(@F) ----"
        $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
        echo "---- Creating $(MY_DEPS_PATH)/$(*F).d ----"
        @$(SHELL) -ec '$(GENERATEDEPS)' | \
         $(AWK_AUTODEP) $(MY_OBJ_PATH) > $(MY_DEPS_PATH)/$(*F).d

$(APS_SRC_PATH)/%.c : $(APS_SRC_PATH)/RCS/%.c,v
        $(CO) $(COFLAGS) $< $@
reply via email to

[Prev in Thread] Current Thread [Next in Thread]