1 # Copyright (c) 1991-2000 Silicon Graphics, Inc.
2 # This document is licensed under the SGI Free Software B license.
5 # http://oss.sgi.com/projects/FreeB
8 # $Header: //depot/main/tools/include/commonrules#21 $
12 # - After including $(ROOT)/usr/include/make/commondefs, a makefile may
13 # say ``include $(COMMONRULES)'' to get this file.
14 # - It is up to the including makefile to define a default rule before
15 # including $(COMMONRULES).
16 # - The parent makefile must define TARGETS in order for clobber to work.
17 # - If the parent makefile must overload the common targets with special
18 # rules (e.g. to perform recursive or subdirectory makes), then set
19 # COMMONPREF to some unique prefix before including $(COMMONRULES),
20 # and make sure that each common target depends on its prefixed name.
21 # For example, a makefile which passes common targets and install on
22 # to makes in subdirectories listed in DIRS might say
25 # include $(COMMONRULES)
27 # $(COMMONTARGS) install: $(COMMONPREF)$$@
28 # @for d in $(DIRS); do \
29 # $(ECHO) "\tcd $$d; $(MAKE) $@"; \
30 # cd $$d; $(MAKE) $@; cd ..; \
33 # Thus, all of the common rules plus install are passed to sub-makes
34 # *and* executed in the current makefile (as xxxclean, xxxclobber,
35 # xxxinstall, etc). SUBDIRS_MAKERULE in commondefs is a convenience
36 # macro that expands to the above loop.
43 $(COMMONPREF)clobber: $(COMMONPREF)clean $(COMMONPREF)rmtargets
53 $(COMMONPREF)rmtargets:
59 # targets to build distributions
63 # build SI distribution
65 @$(INSTALL) $(INSTALLFLAGS) -F $(DIST)/$(DISTDIR_SI) $(DISTFILES_SI)
68 # build OSS distribution
70 @$(INSTALL) $(INSTALLFLAGS_OSS) -F $(DIST)/$(DISTDIR_OSS) $(DISTFILES_OSS)
74 # additional target for .cxx files. (gmake only likes .C and .cc)
77 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
80 # preprocessor only target
83 $(CC) -E $(CPPFLAGS) $(CFLAGS) $< | $(SED) -e 's/^ $$//' | $(UNIQ) > $@
86 $(CXX) -E $(CPPFLAGS) $(CXXFLAGS) $< | $(SED) -e 's/^ $$//' | $(UNIQ) > $@
89 # include the make dependency file(s), if they exist
96 -include $(LOCALRULES)