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)
40 $(MODCC) -o $(TARGET) $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
44 quantify -cache-dir=/tmp \
45 -$(MODCC) -collector=$(COLLECTOR) $(MODCC) -o $(TARGET) \
46 $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
50 $(MODCC) -Xlinker -Bstatic -o $(TARGET) \
51 $(LDFLAGS) $(VOUCHER).o $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS) \
52 -Xlinker -Bdynamic -ldl -Xlinker -Bstatic -lintl
53 # qpt's quick profiling may produce incorrect results in programs
54 # executing interprocedural jumps; this includes setjmp/longjmp.
55 # Hence we must use the -s option for paradyn:
56 /unsup/qpt2/bin/qpt2 -s $(TARGET)
58 VPATH += ../src:$(LIBRARY_DEST):$(TO_CORE)/../lib/$(PLATFORM):$(BACKUP_CORE)/../lib/$(PLATFORM)
64 # Allow this to be ammended by modules
66 $(RM) *.o *.[hC] .__afs* $(TARGET) $(TARGETS)
72 install: $(DEST)/$(TARGET)
74 $(DEST)/$(TARGET): $(TARGET)
75 -$(INSTALL) $(TARGET) $(DEST)
83 # Define DEPENDS dependencies such that the DEPENDS files depends on
84 # the .I files, not the .[Ch] files; otherwise, DEPENDS get rebuilt
85 # all the time. We do need to build the Igen-generated files before
86 # updating DEPENDS, however,
92 ifdef EXPLICIT_DEPENDS
95 DEPENDS: $(SRCS) $(IGEN_ISRCS)
98 $(MAKE) $(IGEN_GEN_SRCS)
100 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) $(filter %.C,$(IGEN_GEN_SRCS)) > DEPENDS
101 # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS) $(IGEN_SRCS) $(NOPED_SRCS)
103 ifdef EXPLICIT_DEPENDS
110 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
112 ifdef IBM_BPATCH_COMPAT
113 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
119 # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS)
124 # A few pattern rules for simplicity. The default lex rule is
125 # redefined, just for the sake of cleanliness. More important are the
126 # igen rules; they "automatically" pick the correct type of igen to
127 # run. Actually, we can't do this completely "right" unless igen is
128 # changed to generate different output files for the various type of
137 $(LEX) -t $(LFLAGS) $< > $@
139 %.mrnet.CLNT.C %.mrnet.CLNT.h %.mrnet.SRVR.C %.mrnet.SRVR.h %.mrnet.h %.mrnet.temp.C: %.I
140 $(IGEN) -mrnet $(ICFLAGS) $<
142 %.xdr.C %.xdr.CLNT.C %.xdr.CLNT.h %.xdr.SRVR.C %.xdr.SRVR.h %.xdr.h %.xdr.temp.C: %.I
143 $(IGEN) -xdr $(ICFLAGS) $<
145 %.thread.C %.thread.CLNT.h %.thread.CLNT.C %.thread.SRVR.h %.thread.SRVR.C %.thread.h: %.I
146 $(IGEN) -thread $(ICFLAGS) $<
148 %.thread.CLNT.C: %.thread.CLNT.h
149 %.thread.SRVR.C: %.thread.SRVR.h
151 # include the dependencies.
153 ifneq ($(MAKECMDGOALS),distclean)
157 # platform-specific options
158 include $(TO_CORE)/make.platform.tmpl