help-make
[Top][All Lists]
Advanced

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

Using archives updating together with %-ed rules


From: Dmitry N. Mikushin
Subject: Using archives updating together with %-ed rules
Date: Fri, 11 Mar 2011 15:57:44 +0300

Hi,

According to manual, make is capable for updating archives when
sources change. I'm trying the following:

%.a: LIBNAME = $(shell echo $(notdir $(basename $@)) | sed s/lib// | \
        tr '[a-z]' '[A-Z]' | tr '/' '_')
%.a: SOURCES = $($(LIBNAME)_SOURCES)
%.a: OBJECTS = $(addprefix $(STORE)/, $(addsuffix .o, $(SOURCES)))
%.a: dirs $@($$(OBJECTS))
        @echo Packing static library $@ ...
        @$(AR) $(ARPARAMS) $@ $(OBJECTS)
        @ranlib $@

$(STORE)/%.c.o: LIBNAME = $(shell echo $(dir $(basename $@)) | sed
s/$(STORE)\\/// | \
        sed s/\\/.*// | tr '[a-z]' '[A-Z]' | tr '/' '_')
$(STORE)/%.c.o: DEPLIBS = $($(LIBNAME)_DEPLIBS)
$(STORE)/%.c.o: DEFINES += $($(LIBNAME)_DEFINES)
$(STORE)/%.c.o: INCLUDES += $($(LIBNAME)_INCLUDES)
$(STORE)/%.c.o: %.c
        @echo Creating object file for $< ...
        @$(CCOMP) $(CPARAMS) $(DEFINES) $(INCLUDES) -c $< -o $@

This rule packages static libraries just fine, if %.a: dirs
$@($$(OBJECTS)) is replaced with %.a: dirs $$(OBJECTS). I'm trying to
understand, why $@(...) does not work here. Do I need to modify
$(STORE)/%.c.o: rule as well, or archive updating simply does not work
with %-ed rules?

Thanks,
- D.



reply via email to

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