update changelog
[platform/upstream/acl.git] / include / buildrules
1 #
2 # Copyright (c) 1999, 2001-2003 Silicon Graphics, Inc.  All Rights Reserved.
3 #
4 # This program is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 #
17 ifndef _BUILDRULES_INCLUDED_
18 _BUILDRULES_INCLUDED_ = 1
19
20 include $(TOPDIR)/include/builddefs
21
22 clean clobber : $(addsuffix -clean,$(SUBDIRS))
23         rm -f $(DIRT)
24         @rm -fr .libs
25
26 %-clean:
27         $(MAKE) -C $* clean
28
29 # Never blow away subdirs
30 ifdef SUBDIRS
31 .PRECIOUS: $(SUBDIRS)
32 .PHONY: $(SUBDIRS)
33
34 $(SUBDIRS):
35         $(MAKE) -C $@
36 endif
37
38 #
39 # Standard targets
40 #
41
42 ifdef LTCOMMAND
43 $(LTCOMMAND) : $(SUBDIRS) $(OBJECTS) $(LTDEPENDENCIES)
44         $(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
45 endif
46
47 ifdef LTLIBRARY
48 $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
49         $(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
50
51 %.lo: %.c
52         $(LTCOMPILE) -c $<
53 endif
54
55 ifdef POTHEAD
56 %.pot: $(XGETTEXTFILES)
57         $(XGETTEXT) --language=C --keyword=_ -o $@ $(XGETTEXTFILES)
58
59 # Generate temp .po files, to check whether translations need updating.
60 # Not by default, due to gettext output differences between versions.
61 %.po: $(POTHEAD)
62 #       $(MSGMERGE) -o $@.tmpo $@ $(POTHEAD)
63 #       if ! diff $@.tmpo $@ >/dev/null; then echo "$@ dated, see $@.tmpo"; fi
64
65 %.mo: %.po
66         $(MSGFMT) -o $@ $<
67 endif
68
69 source :
70         $(SOURCE_MAKERULE)
71
72 endif # _BUILDRULES_INCLUDED_
73
74 $(_FORCE):
75
76 .PHONY : depend
77
78 DEPENDSCRIPT := $(MAKEDEPEND) $(DEPENDFLAGS) -f - -- $(CFLAGS) -- $(CFILES) | \
79         $(SED) -e 's,`pwd`,$(TOPDIR),g' \
80             -e 's,  */[^ ]*,,g' \
81             -e '/^[^ ]*: *$$/d' \
82             -e '/^ *$$/d'
83
84 ifdef LTLIBRARY
85 DEPENDSCRIPT := $(DEPENDSCRIPT) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,'
86 endif
87
88 depend : $(CFILES) $(HFILES) $(addsuffix -depend,$(SUBDIRS))
89         $(DEPENDSCRIPT) > .dep
90         test -s .dep || rm -f .dep
91
92 %-depend:
93         $(MAKE) -C $* depend
94
95 # Include dep, but only if it exists
96 ifeq ($(shell test -f .dep && echo .dep), .dep)
97 include .dep
98 else
99 ifdef LTLIBRARY
100 $(LTOBJECTS): $(HFILES)
101 else
102 $(OBJECTS): $(HFILES)
103 endif
104 endif