]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/buildrules
libxfs: restructure to match kernel layout
[thirdparty/xfsprogs-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) .ltdep .dep
11 @rm -fr $(DIRDIRT)
12 %-clean:
13 @echo "Cleaning $*"
14 $(Q)$(MAKE) $(MAKEOPTS) -C $* clean
15
16 # Never blow away subdirs
17 ifdef SUBDIRS
18 .PRECIOUS: $(SUBDIRS)
19 .PHONY: $(SUBDIRS)
20
21 $(SUBDIRS):
22 @echo "Building $@"
23 $(Q)$(MAKE) $(MAKEOPTS) -q -C $@ || $(MAKE) $(MAKEOPTS) -C $@
24 endif
25
26 #
27 # Standard targets
28 #
29
30 ifdef LTCOMMAND
31 $(LTCOMMAND) : $(SUBDIRS) $(OBJECTS) $(LTDEPENDENCIES)
32 @echo " [LD] $@"
33 $(Q)$(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
34 endif
35
36 ifdef LTLIBRARY
37 $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
38 @echo " [LD] $@"
39 $(Q)$(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
40
41 %.lo: %.c
42 @echo " [CC] $@"
43 $(Q)$(LTCOMPILE) -c $<
44 else
45 %.o: %.c
46 @echo " [CC] $@"
47 $(Q)$(CC) $(CFLAGS) -c $<
48
49 endif
50
51 ifdef POTHEAD
52 $(POTHEAD): $(XGETTEXTFILES)
53 @echo " [GETTXT] $@"
54 $(Q)$(XGETTEXT) --language=C --keyword=_ --keyword=N_ -o $@ $(XGETTEXTFILES)
55
56 # Update translations
57 update-po: $(POTHEAD) $(wildcard $(TOPDIR)/po/*.po)
58 catalogs="$(wildcard $(TOPDIR)/po/*.po)"; \
59 for cat in $$catalogs; do \
60 lang=`basename $$cat .po`; \
61 mv $$lang.po $$lang.old.po; \
62 echo "$$lang:"; \
63 if $(MSGMERGE) $$lang.old.po $(POTHEAD) -o $$lang.po; then \
64 rm -f $$lang.old.po; \
65 else \
66 echo "msgmerge for $$lang failed!"; \
67 rm -f $$lang.po; \
68 mv $$lang.old.po $$lang.po; \
69 fi; \
70 done
71
72 %.mo: %.po
73 @echo " [MSGFMT] $@"
74 $(Q)$(MSGFMT) -c --statistics -o $@ $<
75 endif
76
77 endif # _BUILDRULES_INCLUDED_
78
79 $(_FORCE):
80
81 # dependency build is automatic, relies on gcc -MM to generate.
82 #
83 # This is a bit messy. It regenerates the dependencies on each build so
84 # that we catch files being added and removed. There are other ways of doing
85 # this (e.g. per-file dependency files) but that requires more in-depth changes
86 # to the build system. Compile time is not an issue for us, so the
87 # rebuild on every make invocation isn't a problem we need to care about. Just
88 # do it silently so it doesn't make the build unnecessarily noisy.
89
90 .PHONY : depend ltdepend install-qa
91
92 MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
93
94 ltdepend: rmltdep .ltdep
95
96 rmltdep:
97 $(Q)rm -f .ltdep
98
99 .ltdep: $(CFILES) $(HFILES)
100 $(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep
101
102 depend: rmdep .dep
103
104 rmdep:
105 $(Q)rm -f .dep
106
107 .dep: $(CFILES) $(HFILES)
108 $(Q)$(MAKEDEP) $(CFILES) > .dep