I need to make c or c++ source files into object files and then include both 
for a library.  

Below is the way srcs and objects get defined.  How do get foo.o and bar.o to 
combine to get the lib.

export SRCS = foo.cpp \
              bar.c

.SUFFIXES: .cpp  .c

ifeq ($(firstword $(suffix $(SRCS))),.cpp)
OBJS := $(addprefix $(OBJDIR)/, $(SRCS:.cpp=.o))
else
OBJS := $(addprefix $(OBJDIR)/, $(SRCS:.c=.o))
endif

$(OBJDIR)/%.o: %.cpp
    $(CXX) $(COPTS) $(OSDEFINES) $(EXTRA_DEFINES) $(INCLUDES) -o $@ -c $<

$(OBJDIR)/%.o: %.c
    $(CC) $(COPTS) $(OSDEFINES) $(EXTRA_DEFINES) $(INCLUDES) -o $@ -c $<

$(SHARED_LIB): $(OBJS)
    $(CXX) $(SHLDFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) $(SYSLIBS) -o $(OBJDIR)/$@
    $(CP) $(OBJDIR)/$@ $(PRJLIB)

Rupal Desai





       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to