2 # This file defines the things that should be common to all "libraries"
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.library.tmpl,v 1.31 2008/03/12 20:08:25 legendre Exp $
10 BUILD_ID= -s $(SUITE_NAME) -v $(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM)
12 XTARGET = $(basename $(basename $(TARGET)))
13 VOUCHER = V_$(XTARGET)
16 @echo Updating build voucher information: $(VOUCHER)
17 $(BUILDSTAMP) $(BUILD_ID) $(XTARGET)
18 $(MODCC) -c $(MODCFLAGS) $(VOUCHER).c
23 OBJS += $(filter %.o, $(patsubst %.C, %.o, $(filter %.C,$(notdir $(SRCS)))) \
24 $(patsubst %.c, %.o, $(filter %.c,$(notdir $(SRCS)))) \
25 $(patsubst %.y, %.o, $(filter %.y,$(notdir $(SRCS)))) \
26 $(patsubst %.l, %.o, $(filter %.l,$(notdir $(SRCS)))) \
27 $(patsubst %.s, %.o, $(filter %.s,$(notdir $(SRCS)))) \
28 $(patsubst %.S, %.o, $(filter %.S,$(notdir $(SRCS)))) \
29 $(IGEN_GEN_SRCS:%.C=%.o))
32 XLC_DEPFILES = $(filter %.u, $(patsubst %.u, %.o, $(filter %.u,$(notdir $(SRCS)))))
34 # specify build prerequisite dependencies (for parallel make)
36 $(OBJS): $(PREREQUISITES)
39 XTARGET= $(basename $(basename $(TARGET)))
48 $(TARGET): $(OBJS) $(EXTRA_LIBS)
51 $(LD) $(LDFLAGS) -o $(TARGET) $(VOUCHER).o $(OBJS) $(LIBS)
52 else # build a static lib
53 $(TARGET): $(OBJS) $(EXTRA_LIBS)
56 $(AR) rcs $(TARGET) $(VOUCHER).o $(OBJS)
57 endif # STATIC_LIBRARY
61 $(INCLUDE_DEST)/%.h: $(TO_INC)/%.h
62 $(CP) $^ $(INCLUDE_DEST)
64 public_includes: $(patsubst %,$(INCLUDE_DEST)/%,$(PUBLIC_H))
70 DEST = $(LIBRARY_DEST)
77 $(RM) *.o *.[hC] *.a *.so* .__afs* $(TARGET)
82 $(DEST)/$(TARGET): $(TARGET)
83 -$(CP) $(TARGET) $(DEST)
85 install_generic: $(DEST)/$(TARGET) public_includes
87 # A definition of OVERRIDE_INSTALL will skip this definition, so it shouldn't contain
88 # anything other than "install_generic".
89 ifndef OVERRIDE_INSTALL
90 install: install_generic
94 # dependency generation definitions
103 # Define DEPENDS dependencies such that the DEPENDS files depends on
104 # the .I files, not the .[Ch] files; otherwise, DEPENDS get rebuilt
105 # all the time. We do need to build the Igen-generated files before
106 # updating DEPENDS, however,
112 ifdef EXPLICIT_DEPENDS
115 DEPENDS: $(SRCS) $(IGEN_ISRCS)
118 $(MAKE) $(IGEN_GEN_SRCS)
120 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) $(filter %.C,$(IGEN_GEN_SRCS)) > DEPENDS
121 # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS) $(IGEN_SRCS) $(NOPED_SRCS)
123 ifdef EXPLICIT_DEPENDS
130 ### TODO: remove this in favor of native compiler support
132 $(GCC) -MM $(MODCFLAGS) $(SRCS) > DEPENDS
134 ifdef IBM_BPATCH_COMPAT
136 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
140 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
141 endif #aix/power platform
143 $(DEPCC) $(DEPENDFLAGS) $(MODCFLAGS) $(SRCS) > DEPENDS
144 endif #IBM_BPATCH_COMPAT
146 # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS)
151 # makedepend -fDEPENDS -- $(CFLAGS) $(SRCS)
160 $(LEX) -t $(LFLAGS) $< > $@
163 # A few pattern rules for simplicity in handling igen-generated files.
166 %.mrnet.CLNT.C %.mrnet.CLNT.h %.mrnet.SRVR.C %.mrnet.SRVR.h %.mrnet.h %.mrnet.temp.C: %.I
167 $(IGEN) -mrnet $(ICFLAGS) $<
169 %.xdr.C %.xdr.CLNT.C %.xdr.CLNT.h %.xdr.SRVR.C %.xdr.SRVR.h %.xdr.h %.xdr.temp.C: %.I
171 $(IGEN) -xdr $(ICFLAGS) $<
173 %.thread.C %.thread.CLNT.h %.thread.SRVR.h %.thread.h: %.I
174 $(IGEN) -thread $(ICFLAGS) $<
178 # include the dependencies.
180 ifneq ($(MAKECMDGOALS),distclean)
184 # platform-specific options
185 include $(TO_CORE)/make.platform.tmpl