# -*- makefile -*- # This file defines the things that should be common to all "libraries" # in the paradyn build tree. It depends on things like SRCS and # TARGET being set correctly in the module-specific template and the # architecture-specific Makefile. # # $Id: make.library.tmpl,v 1.31 2008/03/12 20:08:25 legendre Exp $ # BUILD_ID= -s $(SUITE_NAME) -v $(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM) XTARGET = $(basename $(basename $(TARGET))) VOUCHER = V_$(XTARGET) $(VOUCHER): @echo Updating build voucher information: $(VOUCHER) $(HIDE_COMP)$(BUILDSTAMP) $(BUILD_ID) $(XTARGET) $(HIDE_COMP)$(MODCC) -c $(MODCFLAGS) $(VOUCHER).c VPATH += ../src ifndef NO_STD_OBJS OBJS += $(filter %.o, $(patsubst %.C, %.o, $(filter %.C,$(notdir $(SRCS)))) \ $(patsubst %.c, %.o, $(filter %.c,$(notdir $(SRCS)))) \ $(patsubst %.y, %.o, $(filter %.y,$(notdir $(SRCS)))) \ $(patsubst %.l, %.o, $(filter %.l,$(notdir $(SRCS)))) \ $(patsubst %.s, %.o, $(filter %.s,$(notdir $(SRCS)))) \ $(patsubst %.S, %.o, $(filter %.S,$(notdir $(SRCS)))) \ $(IGEN_GEN_SRCS:%.C=%.o)) STATIC_OBJS += $(filter %_nopic.o, $(patsubst %.C, %_nopic.o, $(filter %.C,$(notdir $(SRCS)))) \ $(patsubst %.c, %_nopic.o, $(filter %.c,$(notdir $(SRCS)))) \ $(patsubst %.y, %_nopic.o, $(filter %.y,$(notdir $(SRCS)))) \ $(patsubst %.l, %_nopic.o, $(filter %.l,$(notdir $(SRCS)))) \ $(patsubst %.s, %_nopic.o, $(filter %.s,$(notdir $(SRCS)))) \ $(patsubst %.S, %_nopic.o, $(filter %.S,$(notdir $(SRCS)))) \ $(IGEN_GEN_SRCS:%.C=%_nopic.o)) endif XLC_DEPFILES = $(filter %.u, $(patsubst %.u, %.o, $(filter %.u,$(notdir $(SRCS))))) # specify build prerequisite dependencies (for parallel make) ifdef PREREQUISITES $(OBJS): $(PREREQUISITES) endif XTARGET= $(basename $(basename $(TARGET))) VOUCHER= V_$(XTARGET) ifdef STATIC_COMPS STATIC_LIBRARY = true endif ifndef OVERRIDE_LINK ifndef STATIC_LIBRARY $(TARGET): $(OBJS) $(EXTRA_LIBS) $(HIDE_COMP)$(RM) $(TARGET) $(HIDE_COMP)$(MAKE) $(VOUCHER) $(LD) $(LIBDIR) $(LDFLAGS) -o $(TARGET) $(VOUCHER).o $(OBJS) $(LIBS) else # build a static lib $(TARGET): $(OBJS) $(EXTRA_LIBS) $(HIDE_COMP)$(RM) $(TARGET) $(HIDE_COMP)$(MAKE) $(VOUCHER) $(AR) rcs $(TARGET) $(VOUCHER).o $(OBJS) endif # STATIC_LIBRARY ifdef STATIC_TARGET # pattern rules for building non-PIC .o's %_nopic.o: ../src/%.c @echo "Compiling $< (noPIC)" $(HIDE_COMP)$(CC) -c -o $*_nopic.o $(CFLAGS) $(CPPFLAGS) ../src/$*.c %_nopic.o: ../src/%.C @echo "Compiling $< (noPIC)" $(HIDE_COMP)$(CXX) -c -o $*_nopic.o $(CPPFLAGS) $(CXXFLAGS) ../src/$*.C %_nopic.o: ../src/%.S @echo "Compiling $< (noPIC)" $(HIDE_COMP)$(AS) $(ASFLAGS) -o $*_nopic.o ../src/$*.S %_nopic.o: ../src/%.s @echo "Compiling $< (noPIC)" $(HIDE_COMP)$(AS) $(ASFLAGS) -o $*_nopic.o ../src/$*.s ifdef STATIC_CFLAGS $(STATIC_TARGET): CFLAGS = $(STATIC_CFLAGS) endif ifdef STATIC_CPPFLAGS $(STATIC_TARGET): CPPFLAGS = $(STATIC_CPPFLAGS) endif ifdef STATIC_CXXCFLAGS $(STATIC_TARGET): CXXFLAGS = $(STATIC_CXXFLAGS) endif ifdef STATIC_ASFLAGS $(STATIC_TARGET): ASFLAGS = $(STATIC_ASFLAGS) endif $(STATIC_TARGET): $(STATIC_OBJS) $(HIDE_COMP)$(RM) $(STATIC_TARGET) $(AR) rcs $(STATIC_TARGET) $(STATIC_OBJS) endif # STATIC_TARGET endif # OVERRIDE_LINK ifdef PUBLIC_H $(INCLUDE_DEST)/%.h: $(TO_INC)/%.h $(CP) $^ $(INCLUDE_DEST) public_includes: $(patsubst %,$(INCLUDE_DEST)/%,$(PUBLIC_H)) else public_includes: endif ifndef DEST DEST = $(LIBRARY_DEST) endif echo: echo $(OBJS) clean: $(RM) *.o *.[hC] *.a *.so* .__afs* $(TARGET) $(STATIC_TARGET) distclean: clean $(RM) DEPENDS RELEASE_MAJOR ?= $(RELEASE_NUM) RELEASE_NUM = $(RELEASE_MAJOR).$(RELEASE_MINOR) $(DEST)/$(TARGET): $(TARGET) -$(CP) $(TARGET) $(DEST)/$(TARGET).$(RELEASE_NUM) -cd $(DEST); $(LN) -f $(TARGET).$(RELEASE_NUM) $(TARGET).$(RELEASE_MAJOR) -cd $(DEST); $(LN) -f $(TARGET).$(RELEASE_MAJOR) $(TARGET) ifdef STATIC_TARGET $(DEST)/$(STATIC_TARGET): $(STATIC_TARGET) -$(CP) $(STATIC_TARGET) $(DEST) install_generic: $(DEST)/$(TARGET) public_includes $(DEST)/$(STATIC_TARGET) else install_generic: $(DEST)/$(TARGET) public_includes endif # A definition of OVERRIDE_INSTALL will skip this definition, so it shouldn't contain # anything other than "install_generic". ifndef OVERRIDE_INSTALL install: install_generic endif # # dependency generation definitions # .PHONY : depend depend: $(RM) DEPENDS $(MAKE) DEPENDS # # Define DEPENDS dependencies such that the DEPENDS files depends on # the .I files, not the .[Ch] files; otherwise, DEPENDS get rebuilt # all the time. We do need to build the Igen-generated files before # updating DEPENDS, however, # ifndef DEPENDFLAGS DEPENDFLAGS = -MM endif DEPENDS: @echo "Building depends files" @touch DEPENDS # @$(MAKE) $(SRCS) ifdef XLC_BUILD ifeq ($(DEPCC), xlC) $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > /dev/null cat *.u > DEPENDS rm -f *.u else $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS endif #aix/power platform else ifeq ($(MODCC),cc) $(HIDE_COMP)$(GCC) -MM $(MODCFLAGS) $(SRCS) > DEPENDS else $(HIDE_COMP)$(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS endif #XLC_BUILD endif #.depend.% %.C: # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS) %.C: %.y $(YACC) $(YFLAGS) $< $(MV) y.tab.c $@ %.C: %.l $(LEX) -t $(LFLAGS) $< > $@ # # A few pattern rules for simplicity in handling igen-generated files. # %.mrnet.CLNT.C %.mrnet.CLNT.h %.mrnet.SRVR.C %.mrnet.SRVR.h %.mrnet.h %.mrnet.temp.C: %.I $(IGEN) -mrnet $(ICFLAGS) $< %.xdr.C %.xdr.CLNT.C %.xdr.CLNT.h %.xdr.SRVR.C %.xdr.SRVR.h %.xdr.h %.xdr.temp.C: %.I $(IGEN) -xdr $(ICFLAGS) $< %.thread.C %.thread.CLNT.h %.thread.SRVR.h %.thread.h: %.I $(IGEN) -thread $(ICFLAGS) $< # # include the dependencies. # ifneq ($(MAKECMDGOALS),distclean) include DEPENDS endif # platform-specific options include $(TO_CORE)/make.platform.tmpl # Let's trying prettyprinting the compile lines... %.o : %.c @echo Compiling $< $(HIDE_COMP) $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ %.o : %.C @echo Compiling $< $(HIDE_COMP) $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@