2 # This file defines the things that should be common to all "programs"
3 # in the paradyn build tree. It depends on things like SRCS and
4 # TARGET being set correctly in the module-specific template and the
5 # architecture-specific Makefile.
7 # $Id: make.program.tmpl,v 1.31 2008/02/19 13:36:45 rchen Exp $
10 BUILD_ID= -s $(SUITE_NAME) -v $(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM)
13 DEST = $(PROGRAM_DEST)
19 @echo Updating build voucher information: $(VOUCHER)
20 $(BUILDSTAMP) $(BUILD_ID) $(TARGET)
21 $(MODCC) -c $(MODCFLAGS) $(VOUCHER).c
24 OBJS = $(filter %.o, $(patsubst %.C, %.o, $(filter %.C,$(notdir $(SRCS)))) \
25 $(patsubst %.c, %.o, $(filter %.c,$(notdir $(SRCS)))) \
26 $(patsubst %.y, %.o, $(filter %.y,$(notdir $(SRCS)))) \
27 $(patsubst %.l, %.o, $(filter %.l,$(notdir $(SRCS)))) \
28 $(patsubst %.s, %.o, $(filter %.s,$(notdir $(SRCS)))) \
29 $(patsubst %.S, %.o, $(filter %.S,$(notdir $(SRCS)))) \
30 $(IGEN_GEN_SRCS:%.C=%.o))
32 # PREREQUISITES is a list of files to be generated before general
33 # compilation can proceed. This enables build parallelization.
35 $(OBJS): $(PREREQUISITES)
39 ifneq ($(TARGET),test11)
42 $(MODCC) -o $(TARGET) $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
47 # The user may set APP_PURE_OPTIONS for application-specific purify options
50 purify $(APP_PURE_OPTIONS) -cache-dir=/tmp \
51 -$(MODCC) -collector=$(COLLECTOR) $(MODCC) -o $(TARGET) \
52 $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
58 quantify -cache-dir=/tmp \
59 -$(MODCC) -collector=$(COLLECTOR) $(MODCC) -o $(TARGET) \
60 $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
66 $(MODCC) -Xlinker -Bstatic -o $(TARGET) \
67 $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS) \
68 -Xlinker -Bdynamic -ldl -Xlinker -Bstatic -lintl
69 # qpt's quick profiling may produce incorrect results in programs
70 # executing interprocedural jumps; this includes setjmp/longjmp.
71 # Hence we must use the -s option for paradyn:
72 /unsup/qpt2/bin/qpt2 -s $(TARGET)
75 VPATH += ../src:$(LIBRARY_DEST):$(TO_CORE)/../lib/$(PLATFORM):$(BACKUP_CORE)/../lib/$(PLATFORM)
81 # Allow this to be ammended by modules
83 $(RM) *.o *.[hC] .__afs* $(TARGET) $(TARGETS)
88 ifndef UNCOMMON_INSTALL
89 install: $(DEST)/$(TARGET)
91 $(DEST)/$(TARGET): $(TARGET)
92 -$(CP) $(TARGET) $(DEST)
101 # Define DEPENDS dependencies such that the DEPENDS files depends on
102 # the .I files, not the .[Ch] files; otherwise, DEPENDS get rebuilt
103 # all the time. We do need to build the Igen-generated files before
104 # updating DEPENDS, however,
110 ifdef EXPLICIT_DEPENDS
113 DEPENDS: $(SRCS) $(IGEN_ISRCS)
116 $(MAKE) $(IGEN_GEN_SRCS)
118 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) $(filter %.C,$(IGEN_GEN_SRCS)) > DEPENDS
119 # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS) $(IGEN_SRCS) $(NOPED_SRCS)
121 ifdef EXPLICIT_DEPENDS
128 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
130 ifdef IBM_BPATCH_COMPAT
131 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
137 # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS)
142 # A few pattern rules for simplicity. The default lex rule is
143 # redefined, just for the sake of cleanliness. More important are the
144 # igen rules; they "automatically" pick the correct type of igen to
145 # run. Actually, we can't do this completely "right" unless igen is
146 # changed to generate different output files for the various type of
155 $(LEX) -t $(LFLAGS) $< > $@
157 %.mrnet.CLNT.C %.mrnet.CLNT.h %.mrnet.SRVR.C %.mrnet.SRVR.h %.mrnet.h %.mrnet.temp.C: %.I
158 $(IGEN) -mrnet $(ICFLAGS) $<
160 %.xdr.C %.xdr.CLNT.C %.xdr.CLNT.h %.xdr.SRVR.C %.xdr.SRVR.h %.xdr.h %.xdr.temp.C: %.I
161 $(IGEN) -xdr $(ICFLAGS) $<
163 %.thread.C %.thread.CLNT.h %.thread.CLNT.C %.thread.SRVR.h %.thread.SRVR.C %.thread.h: %.I
164 $(IGEN) -thread $(ICFLAGS) $<
166 %.thread.CLNT.C: %.thread.CLNT.h
167 %.thread.SRVR.C: %.thread.SRVR.h
169 # include the dependencies.
171 ifneq ($(MAKECMDGOALS),distclean)
175 # platform-specific options
176 include $(TO_CORE)/make.platform.tmpl