help-make
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
c and C++ source files in one makefile
From
:
rupal.desai
Subject
:
c and C++ source files in one makefile
Date
:
Mon, 5 May 2008 03:38:57 -0700 (PDT)
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.
reply via email to
[Prev in Thread]
Current Thread
[
Next in Thread
]
c and C++ source files in one makefile
,
rupal.desai
<=
Re: c and C++ source files in one makefile
,
John Calcote
,
2008/05/05
Prev by Date:
colouring output
Next by Date:
Re: c and C++ source files in one makefile
Previous by thread:
colouring output
Next by thread:
Re: c and C++ source files in one makefile
Index(es):
Date
Thread