Create xfstests install target.
[xfstests-dev.git] / include / buildrules
1 #
2 # Copyright (c) 1999, 2001-2003 Silicon Graphics, Inc.  All Rights Reserved.
3 #
4 ifndef _BUILDRULES_INCLUDED_
5 _BUILDRULES_INCLUDED_ = 1
6
7 include $(TOPDIR)/include/builddefs
8
9 clean clobber : $(addsuffix -clean,$(SUBDIRS))
10         rm -f $(DIRT)
11         @rm -fr .libs
12
13 %-clean:
14         $(MAKE) -C $* clean
15
16 # Never blow away subdirs
17 ifdef SUBDIRS
18 .PRECIOUS: $(SUBDIRS)
19 .PHONY: $(SUBDIRS)
20
21 $(SUBDIRS):
22         $(MAKE) -C $@
23 endif
24
25 #
26 # Standard targets
27 #
28
29 ifdef LTCOMMAND
30 $(LTCOMMAND) : $(SUBDIRS) $(OBJECTS) $(LTDEPENDENCIES)
31         $(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
32 endif
33
34 ifdef LTLIBRARY
35 $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
36         $(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
37
38 %.lo: %.c
39         $(LTCOMPILE) -c $<
40 endif
41
42 ifdef POTHEAD
43 %.pot: $(XGETTEXTFILES)
44         $(XGETTEXT) --language=C --keyword=_ -o $@ $(XGETTEXTFILES)
45
46 # Generate temp .po files, to check whether translations need updating.
47 # Not by default, due to gettext output differences between versions.
48 %.po: $(POTHEAD)
49 #       $(MSGMERGE) -o $@.tmpo $@ $(POTHEAD)
50 #       if ! diff $@.tmpo $@ >/dev/null; then echo "$@ dated, see $@.tmpo"; fi
51
52 %.mo: %.po
53         $(MSGFMT) -o $@ $<
54 endif
55
56 source :
57         $(SOURCE_MAKERULE)
58
59 endif # _BUILDRULES_INCLUDED_
60
61 $(_FORCE):
62
63 .PHONY : depend
64
65 DEPENDSCRIPT := $(MAKEDEPEND) $(DEPENDFLAGS) -f - -- $(CFLAGS) -- $(CFILES) | \
66         $(SED) -e 's,`pwd`,$(TOPDIR),g' \
67             -e 's,  */[^ ]*,,g' \
68             -e '/^[^ ]*: *$$/d' \
69             -e '/^ *$$/d'
70
71 ifdef LTLIBRARY
72 DEPENDSCRIPT := $(DEPENDSCRIPT) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,'
73 endif
74
75 depend : $(CFILES) $(HFILES) $(addsuffix -depend,$(SUBDIRS))
76         $(DEPENDSCRIPT) > .dep
77         test -s .dep || rm -f .dep
78
79 %-depend:
80         $(MAKE) -C $* depend
81
82 # Include dep, but only if it exists
83 ifeq ($(shell test -f .dep && echo .dep), .dep)
84 include .dep
85 else
86 ifdef LTLIBRARY
87 $(LTOBJECTS): $(HFILES)
88 else
89 $(OBJECTS): $(HFILES)
90 endif
91 endif