|
From: | Polder, Matthew J |
Subject: | help with converting /usr/ccs/bin/make to GNU make |
Date: | Fri, 23 Jul 2010 13:52:48 -0400 |
I
have a set of Makefiles I’ve used for years with /usr/ccs/bin/make that I
am now trying to get to work with GNU make so I can port from Solaris to Linux.
My directory structure is: project: objs/ src/ lib/ objs: release/ debug/ If
project is a library, then my Makefile boils down to: TARGET
= someLibrary SRC
= "" foo2.cpp foo3.cpp LIB_DIR
= ../$(TARGET)/lib OBJ_DIR
= ../$(TARGET)/obj OBJ_RELEASE_DIR
= release #This
next line appears to work. For /usr/ccs/bin/make I used: #
OBJS =
$(SRC:%.cpp=${OBJ_DIR}/${OBJ_RELEASE_DIR}/%.o) OBJS
= $(patsubst %.cpp,$(OBJ_DIR)/$( OBJ_RELEASE_DIR)/%.o,$(SRC)) #This
is the part that doesn’t work. I’ve tried $^, $< but they resolve
to blank space instead of #the
desired name of the cpp file. $(OBJS):
$(patsubst %.o,%.cpp,$(notdir $@)) g++
-c $^ -o $@ #I
used to use this line #${OBJS}:
address@hidden:%.o=%.cpp} # g++
-c ${*F}.cpp -o $@ $(LIB_DIR)/lib$(TARGET).a:
$(OBJS) #command
to link together the library |
[Prev in Thread] | Current Thread | [Next in Thread] |