# # This file defines the things that should be common to all "programs" # 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.program.tmpl,v 1.31 2008/02/19 13:36:45 rchen Exp $ # BUILD_ID= -s $(SUITE_NAME) -v $(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM) ifndef DEST DEST = $(TO_CORE)/$(PROGRAM_DEST) endif ifndef TARGETS VOUCHER = V_$(TARGET) $(VOUCHER): @echo Updating build voucher information: $(VOUCHER) $(BUILDSTAMP) $(BUILD_ID) $(TARGET) $(MODCC) -c $(MODCFLAGS) $(VOUCHER).c endif 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)) # PREREQUISITES is a list of files to be generated before general # compilation can proceed. This enables build parallelization. ifdef PREREQUISITES $(OBJS): $(PREREQUISITES) endif ifndef UNCOMMON_LINK ifneq ($(TARGET),test11) $(TARGET): $(OBJS) @$(MAKE) $(VOUCHER) $(MODCC) -o $(TARGET) $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS) endif endif #ifndef UNCOMMON_LINK # The user may set APP_PURE_OPTIONS for application-specific purify options pure: $(OBJS) @$(MAKE) $(VOUCHER) purify $(APP_PURE_OPTIONS) -cache-dir=/tmp \ -$(MODCC) -collector=$(COLLECTOR) $(MODCC) -o $(TARGET) \ $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS) #endif ifndef UNCOMMON_LINK quantify: $(OBJS) @$(MAKE) $(VOUCHER) quantify -cache-dir=/tmp \ -$(MODCC) -collector=$(COLLECTOR) $(MODCC) -o $(TARGET) \ $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS) endif ifndef UNCOMMON_LINK qpt: $(OBJS) @$(MAKE) $(VOUCHER) $(MODCC) -Xlinker -Bstatic -o $(TARGET) \ $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS) \ -Xlinker -Bdynamic -ldl -Xlinker -Bstatic -lintl # qpt's quick profiling may produce incorrect results in programs # executing interprocedural jumps; this includes setjmp/longjmp. # Hence we must use the -s option for paradyn: /unsup/qpt2/bin/qpt2 -s $(TARGET) endif VPATH += ../src:$(TO_CORE)/$(LIBRARY_DEST):$(TO_CORE)/../lib/$(PLATFORM):$(BACKUP_CORE)/../lib/$(PLATFORM) echo: echo $(VPATH) # Allow this to be ammended by modules clean:: $(RM) *.o *.[hC] .__afs* $(TARGET) $(TARGETS) distclean:: clean $(RM) DEPENDS ifndef UNCOMMON_INSTALL install: $(DEST)/$(TARGET) $(DEST)/$(TARGET): $(TARGET) -$(CP) $(TARGET) $(DEST) endif .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 ifdef IGEN_ISRCS ifdef EXPLICIT_DEPENDS DEPENDS: else DEPENDS: $(SRCS) $(IGEN_ISRCS) endif touch DEPENDS $(MAKE) $(IGEN_GEN_SRCS) $(MAKE) $(SRCS) $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) $(filter %.C,$(IGEN_GEN_SRCS)) > DEPENDS # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS) $(IGEN_SRCS) $(NOPED_SRCS) else ifdef EXPLICIT_DEPENDS DEPENDS: else DEPENDS: $(SRCS) endif touch DEPENDS $(MAKE) $(SRCS) $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS ifdef IBM_BPATCH_COMPAT ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM))) cat *.u > DEPENDS rm -f *.u endif endif # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS) endif # A few pattern rules for simplicity. The default lex rule is # redefined, just for the sake of cleanliness. More important are the # igen rules; they "automatically" pick the correct type of igen to # run. Actually, we can't do this completely "right" unless igen is # changed to generate different output files for the various type of # interfaces. # %.C: %.y $(YACC) $(YFLAGS) $< $(MV) y.tab.c $@ %.C: %.l $(LEX) -t $(LFLAGS) $< > $@ %.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.CLNT.C %.thread.SRVR.h %.thread.SRVR.C %.thread.h: %.I $(IGEN) -thread $(ICFLAGS) $< %.thread.CLNT.C: %.thread.CLNT.h %.thread.SRVR.C: %.thread.SRVR.h # # include the dependencies. # ifneq ($(MAKECMDGOALS),distclean) include DEPENDS endif # platform-specific options include $(TO_CORE)/make.platform.tmpl