Hi,
I am using a "generic" makefile defining implicit rules so that it can be included by several makefiles in several directories.
I have a problem for generating archives (.a and .so).
Here is the makefile in the target dir. The idea is to define the list of archives and, for each archive, the list of objects to store in it.
------------------------------------------
# Example of makefile
LIBS := lib
OBJS_lib := test.o
include c.mk ------------------------------------------- # Generic makefile for use in several projects # c.mk .SUFFIXES : .c .o .a .PHONY : all
ALIBS := $(LIBS:%=%.a)
%.o : %.c
touch $@%.a :
ar crvs $@ $(OBJS_$(@F:%.a=%))all : $(ALIBS) ---------------------------------------------
This can be tested after creating a dummy test.c, then calling make ar crvs lib.a test.o ar: test.o: No such file or directory
The only solution I have found is to append (after the include) in each makefile:
lib.a : $(OBJS_lib)
Then, "make" knows that for lib.a and %.a implicit rule, test_x.o is a prerequisit.
I would like to move this explicit definition that "lib.a" needs $(OBJS_lib), in the implicit part of the scheme.
I have tried %.a : $(OBJS_$(@F:%.a=%)) in the implicit rule but this does not work because: "Note that expansion using `%' in pattern rules occurs after any variable or function expansions", so @F expands probably to "%a".
Is there a nice way to write an implicite rule for an archive, using a variable for defining the list of prerequisits?
Or is there a different way (using archive features from �11) to solve this problem?
Thank's in advance
_______________________________________________ help-gnu-utils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gnu-utils
