Dyninst API library now uses fork() instead of vfork() when creating
[dyninst.git] / make.program.tmpl
1 #
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.
6
7 # $Log: make.program.tmpl,v $
8 # Revision 1.12  1996/11/14 14:18:34  naim
9 # Minor change to make qpt work for paradynd - naim
10 #
11 # Revision 1.11  1996/08/05 07:08:53  tamches
12 # used BACKUP_CORE to remove a /p/paradyn dependency in VPATH
13 #
14 # Revision 1.10  1996/04/29 03:27:55  tamches
15 # added APP_PURE_OPTIONS for application-specific purify options
16 #
17 # Revision 1.9  1996/01/05 19:52:09  tamches
18 # igen --> $(IGEN)
19 #
20 # Revision 1.8  1995/11/29 00:14:12  tamches
21 # added -cache-dir=/tmp option to purify so we don't run out of disk space
22 # while purify works.  Added quantify; added qpt.
23 #
24 # Revision 1.7  1995/08/29  20:18:17  krisna
25 # removed the "tmp" directory references
26 # changed "cp" BACK TO "mv" for yacc output
27 #
28 # Revision 1.6  1995/08/24 15:00:55  hollings
29 # AIX/SP-2 port (including option for split instruction/data heaps)
30 # Tracing of rexec (correctly spawns a paradynd if needed)
31 # Added rtinst function to read getrusage stats (can now be used in metrics)
32 # Critical Path
33 # Improved Error reporting in MDL sematic checks
34 # Fixed MDL Function call statement
35 # Fixed bugs in TK usage (strings passed where UID expected)
36 #
37 # Revision 1.5  1995/03/15  19:12:13  jcargill
38 # Added real pure rule, and fixed LDFLAGS
39 #
40 # Revision 1.4  1995/02/27  17:37:06  jcargill
41 # Added support for suppressing implicit dependency generation
42 # (EXPLICIT_DEPENDS) and removed PD_NO_DEPENDS support
43 #
44 # Revision 1.3  1995/02/16  07:56:46  markc
45 # Added flag to prevent generation of DEPENDS file if PD_NO_DEPENDS is true
46 # to save time during recompiles.
47 #
48 # Revision 1.2  1995/01/30  21:26:15  jcargill
49 # Better use of TO_CORE for modules below top-level (e.g. visiClients)
50 #
51 # Revision 1.1  1995/01/30  18:08:21  jcargill
52 # Major build system reorganization
53 #
54 #
55
56 OBJS =          $(patsubst %.C, %.o, $(filter %.C,$(notdir $(SRCS)))) \
57                 $(patsubst %.c, %.o, $(filter %.c,$(notdir $(SRCS)))) \
58                 $(patsubst %.y, %.o, $(filter %.y,$(notdir $(SRCS)))) \
59                 $(patsubst %.l, %.o, $(filter %.l,$(notdir $(SRCS)))) \
60                 $(patsubst %.s, %.o, $(filter %.s,$(notdir $(SRCS)))) \
61                 $(patsubst %.S, %.o, $(filter %.S,$(notdir $(SRCS)))) \
62                 $(IGEN_GEN_SRCS:%.C=%.o)
63
64 ifndef UNCOMMON_LINK
65 $(TARGET): $(OBJS) $(LIBS)
66         $(MODCC) -o $(TARGET) $(LDFLAGS) $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
67 endif
68
69 ifndef UNCOMMON_LINK
70 # The user may set APP_PURE_OPTIONS for application-specific purify options
71 pure: $(OBJS) $(LIBS)
72         purify $(APP_PURE_OPTIONS) -cache-dir=/tmp -$(MODCC) -collector=$(COLLECTOR) $(MODCC) -o $(TARGET) $(LDFLAGS) $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
73 endif
74
75 ifndef UNCOMMON_LINK
76 quantify: $(OBJS) $(LIBS)
77         quantify -cache-dir=/tmp -$(MODCC) -collector=$(COLLECTOR) $(MODCC) -o $(TARGET) $(LDFLAGS) $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS)
78 endif
79
80 ifndef UNCOMMON_LINK
81 qpt: $(OBJS) $(LIBS)
82         $(MODCC) -Xlinker -Bstatic -o $(TARGET) $(LDFLAGS) $(OBJS) $(LIBDIR) $(LIBS) $(SYSLIBS) -Xlinker -Bdynamic -ldl -Xlinker -Bstatic -lintl
83         # qpt's quick profiling may produce incorrect results in programs
84         # executing interprocedural jumps; this includes setjmp/longjmp.
85         # Hence we must use the -s option for paradyn:
86         /unsup/qpt2/bin/qpt2 -s $(TARGET)
87 endif
88
89 ifndef DEST
90 DEST            = $(TO_CORE)/../bin/$(PLATFORM)
91 endif
92
93 #VPATH          += ../src:$(TO_CORE)/../lib/$(PLATFORM):/p/paradyn/lib/$(PLATFORM)
94 VPATH           += ../src:$(TO_CORE)/../lib/$(PLATFORM):$(BACKUP_CORE)/../lib/$(PLATFORM)
95
96
97 echo:
98         echo $(VPATH)
99
100 clean:
101         rm -f *.o *.[hC] $(TARGET)
102
103 install:  $(DEST)/$(TARGET)
104
105 $(DEST)/$(TARGET): $(TARGET)
106         cp $(TARGET) $(DEST)
107
108 .PHONY : depend
109 depend:
110         rm -f DEPENDS
111         $(MAKE) DEPENDS
112
113
114 # Define DEPENDS dependencies such that the DEPENDS files depends on
115 # the .I files, not the .[Ch] files; otherwise, DEPENDS get rebuilt
116 # all the time.  We do need to build the Igen-generated files before
117 # updating DEPENDS, however,
118 #
119 ifdef IGEN_ISRCS
120 ifdef EXPLICIT_DEPENDS
121 DEPENDS:
122 else
123 DEPENDS: $(SRCS) $(IGEN_ISRCS)
124 endif
125         touch DEPENDS
126         $(MAKE) $(IGEN_GEN_SRCS)
127         $(MAKE) $(SRCS)
128         $(MODCC) -MM $(MODCFLAGS) $(SRCS) $(IGEN_GEN_SRCS) > DEPENDS
129 #       makedepend -fDEPENDS -- $(CFLAGS) $(SRCS) $(IGEN_SRCS) $(NOPED_SRCS)
130 else
131 ifdef EXPLICIT_DEPENDS
132 DEPENDS:
133 else
134 DEPENDS: $(SRCS)
135 endif
136         touch DEPENDS
137         $(MAKE) $(SRCS)
138         $(MODCC) -MM $(MODCFLAGS) $(SRCS) > DEPENDS
139 #       makedepend -fDEPENDS -- $(CFLAGS) $(SRCS)
140 endif
141
142
143
144 # A few pattern rules for simplicity.  The default lex rule is
145 # redefined, just for the sake of cleanliness.  More important are the
146 # igen rules; they "automatically" pick the correct type of igen to
147 # run.  Actually, we can't do this completely "right" unless igen is
148 # changed to generate different output files for the various type of
149 # interfaces.
150 #
151
152 %.C: %.y
153         $(YACC) $(YFLAGS) $<
154         mv y.tab.c $@
155
156 %.C: %.l
157         $(LEX) -t $(LFLAGS) $< > $@
158
159 %.xdr.C %.xdr.CLNT.C %.xdr.CLNT.h %.xdr.SRVR.C %.xdr.SRVR.h %.xdr.h: %.I
160         $(IGEN) -xdr $(ICFLAGS) $<
161
162 %.thread.C %.thread.CLNT.h %.thread.SRVR.h %.thread.h: %.I
163         $(IGEN) -thread $(ICFLAGS) $<
164
165 #
166 # include the dependencies.
167 #
168 include DEPENDS