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.library.tmpl
179 lines (145 loc) · 4.09 KB
/
make.library.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
177
178
179
#
# This file defines the things that should be common to all "libraries"
# 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.library.tmpl,v 1.31 2008/03/12 20:08:25 legendre Exp $
#
BUILD_ID= -s $(SUITE_NAME) -v $(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM)
XTARGET = $(basename $(basename $(TARGET)))
VOUCHER = V_$(XTARGET)
$(VOUCHER):
@echo Updating build voucher information: $(VOUCHER)
$(BUILDSTAMP) $(BUILD_ID) $(XTARGET)
$(MODCC) -c $(MODCFLAGS) $(VOUCHER).c
VPATH += ../src
ifndef NO_STD_OBJS
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))
endif
XLC_DEPFILES = $(filter %.u, $(patsubst %.u, %.o, $(filter %.u,$(notdir $(SRCS)))))
# specify build prerequisite dependencies (for parallel make)
ifdef PREREQUISITES
$(OBJS): $(PREREQUISITES)
endif
XTARGET= $(basename $(basename $(TARGET)))
VOUCHER= V_$(XTARGET)
ifndef OVERRIDE_LINK
ifndef STATIC_LIBRARY
$(TARGET): $(OBJS) $(EXTRA_LIBS)
@$(RM) $(TARGET)
@$(MAKE) $(VOUCHER)
$(LD) $(LDFLAGS) -o $(TARGET) $(VOUCHER).o $(OBJS) $(LIBS)
else # build a static lib
$(TARGET): $(OBJS) $(EXTRA_LIBS)
@$(RM) $(TARGET)
@$(MAKE) $(VOUCHER)
$(AR) rcs $(TARGET) $(VOUCHER).o $(OBJS)
endif # STATIC_LIBRARY
endif # OVERRIDE_LINK
ifdef PUBLIC_H
$(TO_CORE)/$(INCLUDE_DEST)/%.h: $(TO_INC)/%.h
$(CP) $^ $(TO_CORE)/$(INCLUDE_DEST)
public_includes: $(patsubst %,$(TO_CORE)/$(INCLUDE_DEST)/%,$(PUBLIC_H))
else
public_includes:
endif
ifndef DEST
DEST = $(TO_CORE)/$(LIBRARY_DEST)
endif
echo:
echo $(OBJS)
clean:
$(RM) *.o *.[hC] *.a *.so* .__afs* $(TARGET)
distclean: clean
$(RM) DEPENDS
$(DEST)/$(TARGET): $(TARGET)
-$(CP) $(TARGET) $(DEST)
install_generic: $(DEST)/$(TARGET)
ifndef OVERRIDE_INSTALL
install: install_generic public_includes
endif
#
# dependency generation definitions
#
.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)
### TODO: remove this in favor of native compiler support
ifeq ($(MODCC),cc)
gcc -MM $(MODCFLAGS) $(SRCS) > DEPENDS
else
ifdef IBM_BPATCH_COMPAT
ifeq ($(DEPCC), xlC)
$(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
cat *.u > DEPENDS
rm -f *.u
else
$(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
endif #aix/power platform
else
$(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
endif #IBM_BPATCH_COMPAT
endif
# makedepend -fDEPENDS -- $(CFLAGS) $(SRCS)
endif
#.depend.% %.C:
# makedepend -fDEPENDS -- $(CFLAGS) $(SRCS)
pure:
%.C: %.y
$(YACC) $(YFLAGS) $<
$(MV) y.tab.c $@
%.C: %.l
$(LEX) -t $(LFLAGS) $< > $@
#
# A few pattern rules for simplicity in handling igen-generated files.
#
%.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.SRVR.h %.thread.h: %.I
$(IGEN) -thread $(ICFLAGS) $<
#
# include the dependencies.
#
ifneq ($(MAKECMDGOALS),distclean)
include DEPENDS
endif
# platform-specific options
include $(TO_CORE)/make.platform.tmpl