]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/buildmacros
Merge back recent changes from xfs kernel headers.
[thirdparty/xfsprogs-dev.git] / include / buildmacros
1 #
2 # Copyright (c) 2002-2005 Silicon Graphics, Inc.
3 # All Rights Reserved.
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it would be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write the Free Software Foundation,
15 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 #
17
18 BUILDRULES = $(TOPDIR)/include/buildrules
19
20 # LCFLAGS, LLDFLAGS, LLDLIBS, LSRCFILES and LDIRT may be specified in
21 # user Makefiles. Note: LSRCFILES is anything other than Makefile, $(CFILES)
22 # $(CXXFILES), or $(HFILES) and is used to construct the manifest list
23 # during the "dist" phase (packaging).
24
25 LDFLAGS = $(LLDFLAGS)
26 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
27
28 MAKEOPTS = --no-print-directory
29 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
30
31 DEPDIRT = dep dep.bak
32 MANDIRT = *.[1-9].gz
33 PODIRT = *.tmpo *.mo
34 CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
35 DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
36
37 OBJECTS = $(ASFILES:.s=.o) \
38 $(CFILES:.c=.o) \
39 $(LFILES:.l=.o) \
40 $(YFILES:%.y=%.tab.o)
41
42 INSTALL = $(TOPDIR)/install-sh -o $(PKG_USER) -g $(PKG_GROUP)
43
44 SHELL = /bin/sh
45 IMAGES_DIR = $(TOPDIR)/all-images
46 DIST_DIR = $(TOPDIR)/dist
47
48 CCF = $(CC) $(CFLAGS) $(CPPFLAGS)
49 MAKEF = $(MAKE) $(MAKEOPTS)
50 CXXF = $(CXX) $(CXXFLAGS)
51
52 # For libtool.
53 LIBNAME = $(basename $(LTLIBRARY))
54 LTOBJECTS = $(OBJECTS:.o=.lo)
55 LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
56
57 LTLINK = $(LIBTOOL) --mode=link $(CC)
58 LTEXEC = $(LIBTOOL) --mode=execute
59 LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
60 LTCOMPILE = $(LIBTOOL) --mode=compile $(CCF)
61
62 ifeq ($(ENABLE_SHARED),yes)
63 LTLDFLAGS += -rpath $(PKG_LIB_DIR)
64 LTLDFLAGS += -version-info $(LTVERSION)
65 endif
66
67 ifeq ($(ENABLE_SHARED),yes)
68 INSTALL_LTLIB = \
69 cd $(TOPDIR)/$(LIBNAME)/.libs; \
70 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
71 ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_LIB_DIR); \
72 ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_LIB_DIR)
73 endif
74
75 # Libtool thinks the static and shared libs should be in the same dir, so
76 # make the static lib appear in the place we chose as rpath (using the two
77 # symlinks below).
78 # Other things want the shared libs to appear in /usr/lib, else they'll
79 # link with the static libs there. So, another symlink to get the .so into
80 # /usr/lib.
81 ifeq ($(ENABLE_SHARED),yes)
82 INSTALL_LTLIB_DEV = \
83 cd $(TOPDIR)/$(LIBNAME)/.libs; \
84 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
85 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \
86 ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \
87 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
88 ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \
89 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
90 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
91 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so
92 else
93 INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
94 endif
95
96 INSTALL_LTLIB_STATIC = \
97 cd $(TOPDIR)/$(LIBNAME)/.libs; \
98 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
99 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR)
100
101 INSTALL_MAN = \
102 @for d in $(MAN_PAGES); do \
103 first=true; \
104 for m in `$(AWK) \
105 '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
106 | $(SED) \
107 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
108 -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \
109 do \
110 [ -z "$$m" -o "$$m" = "\\" ] && continue; \
111 t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
112 if $$first; then \
113 if $(HAVE_ZIPPED_MANPAGES); then \
114 $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
115 fi; \
116 u=$$m.$(MAN_SECTION)$$_sfx; \
117 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
118 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
119 else \
120 echo $(INSTALL) -S $$u $${t}$$_sfx; \
121 $(INSTALL) -S $$u $${t}$$_sfx; \
122 fi; \
123 first=false; \
124 done; \
125 done
126
127 ifeq ($(ENABLE_GETTEXT),yes)
128 INSTALL_LINGUAS = \
129 @for l in $(LINGUAS) ""; do \
130 if test -f "$$l.mo" ; then \
131 ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
132 $(INSTALL) -m 755 -d $$ldir; \
133 $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
134 fi; \
135 done
136 endif
137
138 SUBDIRS_MAKERULE = \
139 @for d in $(SUBDIRS) ""; do \
140 if test -d "$$d" -a ! -z "$$d"; then \
141 $(ECHO) === $$d ===; \
142 $(MAKEF) -C $$d $@ || exit $$?; \
143 fi; \
144 done
145
146 MAN_MAKERULE = \
147 @for f in *.[12345678] ""; do \
148 if test ! -z "$$f"; then \
149 $(ZIP) --best -c < $$f > $$f.gz; \
150 fi; \
151 done
152
153 DIST_MAKERULE = \
154 $(MAKEF) -C build dist
155
156 SOURCE_MAKERULE = \
157 @test -z "$$DIR" && DIR="."; \
158 for f in $(SRCFILES) ""; do \
159 if test ! -z "$$f"; then $(ECHO) $$DIR/$$f; fi;\
160 done; \
161 for d in `echo $(SUBDIRS)` ; do \
162 if test -d "$$d" -a ! -z "$$d"; then \
163 $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \
164 fi; \
165 done