This repository has been archived by the owner on Mar 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.program.tmpl
176 lines (146 loc) · 4.68 KB
/
make.program.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# 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