[Top][All Lists]

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

Question with gmake 3.80 and substitution references

From: Jamulla, John D
Subject: Question with gmake 3.80 and substitution references
Date: Thu, 4 Sep 2003 09:37:15 -0700


I am using gmake 3.80 on Solaris 2.8. I'm having a problem with a simple
suffix replacement.

1. In a local makefile I tried to put the following line at the end of the
makefile, it doesn't work:
-include $(LIB_FILES:%.c=$(DEPEND_DIR)/%.P)

but the following line DOES work:
-include $(LIB_FILES:%.cpp=$(DEPEND_DIR)/%.P)

I have a variable in the same local makefile called LIB_FILES, it's set as
follows (before the above lines):
LIB_FILES    =  \
junk.c \
EarRecorder.cpp \

I wanted this to be the list of source files to compile, both C and C++
files would be in this list. I'll convert these to objects with the
following variable substitutions.

In the makefile, towards the end of it, I include another makefile called
Common_Make_Rules, here's the excerpt of the end of the local makefile:
# Include rules common to all make files
include ${TOPDIR}/build/Common_Make_Rules

# Include all dependency files
-include $(LIB_FILES:%.cpp=$(DEPEND_DIR)/%.P)
#-include $(LIB_FILES:%.c=$(DEPEND_DIR)/%.P)

which has the following in it:

LIB_OBJS             = $(LIB_FILES: %.c =$(OBJ_DIR)/%.o)

I expected this to take my source files listed in the LIB_FILES (with a .c
suffix) and replace the
.c with a .o. BUT, what I get instead is the original filenames, which means
it does NOT replace anything.

If I comment out the above line and use the line below instead, the same
thing happens, as long as I have the junk.c listed in the LIB_FILES above
(no replacements happen).

LIB_OBJS            += $(LIB_FILES: %.cpp=$(OBJ_DIR)/%.o)

If I remove the junk.c and use the above line which should convert .cpp's to
.o's it works just fine.

I'm really not sure why I'm having a problem with the .c lines above. The
.cpp ones work ok. I guess I'm missing something subtle?

I'm not on the mailing list so please Cc: me directly if you can help me.

John D. Jamulla - Senior Engineer
Northrop Grumman Corporation
Electronic Systems
Amherst Systems
Buffalo N.Y. 14221, (716) 631-0610
address@hidden, or address@hidden
 <<John D. Jamulla (E-mail).vcf>> 

Attachment: John D. Jamulla (E-mail).vcf
Description: Binary data

reply via email to

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