Hi all. I have a make build system that I am trying to decipher that someone else wrote. I am getting an error when I run it on a
redhat system, but not when I run it on my solaris system. The versions of gmake are the same major revision (one off on minor revision).
This is for building a C project, and the make system has a global Makefile.global that is inherited by each directory's local Makefile
The Makefile.global has all the targets in it, starting with
all: $(LIB) $(BIN)
where LIB builds libs and BIN builds binaries.
jumping down the targets I have
$(LIB) : $(GEN_LIB)
$(GEN_LIB) : $(GEN_DEPS) $(GEN_OBJS)
$(AR) $(ARFLAGS) $(GEN_LIB) $(GEN_OBJS)
$(GEN_DEPS) :
@set -e; rm -f $@; \
$(CC) $(CDEP_FLAG) $(CFLAGS) $(INCDIRS) `basename $@ | sed 's/\.d/\.c/' | sed 's,^,$(HOME_SRC)/,'` | sed 's,\(.*\)\.o: ,$(GEN_OBJDIR)/\1.o $@ :,g' >
[email protected] ; \
cat
[email protected] > $@ ; \
cat
[email protected] | cut -d: -f2 | grep '\.h' | sed 's,\.h,.h :,g' >> $@ ; \
rm
[email protected]
$(GEN_OBJS) :
$(CC) $(CFLAGS) $(INCDIRS) -c $(*F).c -lmpi -o $@
I think these are all the relevant targets I need to include to answer my question.
Definitions of those variables:
CC = icc
CDEP_FLAG = -M
CFLAGS = various compiler flags ifdef type flags
INCDIRS = include directory where all .h files are
GEN_OBJDIR = /lib/objs
HOME_SRC = .
GEN_LIB = lib/$(LIB)
GEN_DEPDIR=/lib/deps
GEN_DEPS = $(addprefix $(GEN_DEPDIR)/,$(addsuffix .d,$(basename $(OBJS))))
I think this has everything covered you need. Basically self explanatory from the names.
Now as best I can tell, this is generating in /lib/deps a .d file that has the object and source dependencies in it. In other words, for the utilities.a library, I will get a utils.o and utils.c dependency stack, all in the file utils.d
There is some syntax error that is being generated in that file I think, because I get the following error:
../lib/deps/util.d:25: *** target pattern contains no '%'. Stop.
gmake[2]: *** [all] Error 2
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2
I am not sure if my error is in the dependency generation, or some further down part, like the object generation target?
If you need further info, let me know, I will add to post