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