]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/buildmacros
Sync up with minor kernel change (noop change for userspace).
[thirdparty/xfsprogs-dev.git] / include / buildmacros
CommitLineData
3ded4129
NS
1#
2# Copyright (c) 2002 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 version 2 of the GNU General Public License as
6# published by the Free Software Foundation.
7#
8# This program is distributed in the hope that it would be useful, but
9# WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11#
12# Further, this software is distributed without any warranty that it is
13# free of the rightful claim of any third person regarding infringement
14# or the like. Any license provided herein, whether implied or
15# otherwise, applies only to this software file. Patent licenses, if
16# any, provided herein do not apply to combinations of this program with
17# other software, or any other product whatsoever.
18#
19# You should have received a copy of the GNU General Public License along
20# with this program; if not, write the Free Software Foundation, Inc., 59
21# Temple Place - Suite 330, Boston MA 02111-1307, USA.
22#
23# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24# Mountain View, CA 94043, or:
25#
26# http://www.sgi.com
27#
28# For further information regarding this notice, see:
29#
30# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31#
32
3ded4129
NS
33BUILDRULES = $(TOPDIR)/include/buildrules
34
35# LCFLAGS, LLDFLAGS, LLDLIBS, LSRCFILES and LDIRT may be specified in
36# user Makefiles. Note: LSRCFILES is anything other than Makefile, $(CFILES)
37# $(CXXFILES), or $(HFILES) and is used to construct the manifest list
38# during the "dist" phase (packaging).
39
40LDFLAGS = $(LLDFLAGS)
41LDLIBS = $(LLDLIBS) $(MALLOCLIB)
42
43MAKEOPTS = --no-print-directory
44SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
9440d84d
NS
45
46DEPDIRT = dep dep.bak
47MANDIRT = *.[1-9].gz
48PODIRT = *.tmpo *.mo
49CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
50DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
3ded4129
NS
51
52OBJECTS = $(ASFILES:.s=.o) \
53 $(CFILES:.c=.o) \
54 $(LFILES:.l=.o) \
55 $(YFILES:%.y=%.tab.o)
56
57INSTALL = $(TOPDIR)/install-sh -o root -g root
58
59SHELL = /bin/sh
60IMAGES_DIR = $(TOPDIR)/all-images
61DIST_DIR = $(TOPDIR)/dist
62
4e6ff442 63CCF = $(CC) $(CFLAGS) $(CPPFLAGS)
3ded4129
NS
64MAKEF = $(MAKE) $(MAKEOPTS)
65CXXF = $(CXX) $(CXXFLAGS)
66LDF = $(LD) $(LDFLAGS)
67
68# For libtool.
69LIBNAME = $(basename $(LTLIBRARY))
70LTOBJECTS = $(OBJECTS:.o=.lo)
71LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
72
73LTLINK = $(LIBTOOL) --mode=link $(CC)
74LTEXEC = $(LIBTOOL) --mode=execute
75LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
76LTCOMPILE = $(LIBTOOL) --mode=compile $(CCF) -D_REENTRANT -fno-strict-aliasing
77
78ifeq ($(ENABLE_SHARED),yes)
6c6508ec 79LTLDFLAGS += -rpath $(PKG_LIB_DIR)
3ded4129
NS
80LTLDFLAGS += -version-info $(LTVERSION)
81endif
82
83ifeq ($(ENABLE_SHARED),yes)
84INSTALL_LTLIB = \
85 cd $(TOPDIR)/$(LIBNAME)/.libs; \
6c6508ec
NS
86 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
87 ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_LIB_DIR); \
3ded4129 88 test "$(PKG_DISTRIBUTION)" = debian || \
6c6508ec 89 ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_LIB_DIR)
3ded4129
NS
90endif
91
92# Libtool thinks the static and shared libs should be in the same dir, so
93# make the static lib appear in the place we chose as rpath (using the two
94# symlinks below).
95# Other things want the shared libs to appear in /usr/lib, else they'll
96# link with the static libs there. So, another symlink to get the .so into
97# /usr/lib.
98ifeq ($(ENABLE_SHARED),yes)
99INSTALL_LTLIB_DEV = \
100 cd $(TOPDIR)/$(LIBNAME)/.libs; \
6c6508ec
NS
101 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
102 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \
103 ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \
3ded4129 104 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
6c6508ec
NS
105 ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \
106 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
107 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
108 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so
3ded4129
NS
109else
110INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
111endif
112
113INSTALL_LTLIB_STATIC = \
114 cd $(TOPDIR)/$(LIBNAME)/.libs; \
6c6508ec
NS
115 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
116 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR)
3ded4129
NS
117
118INSTALL_MAN = \
119 @for d in $(MAN_PAGES); do \
120 first=true; \
121 for m in `$(AWK) \
122 '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
123 | $(SED) \
124 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
125 -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \
126 do \
127 [ -z "$$m" -o "$$m" = "\\" ] && continue; \
128 t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
129 if $$first; then \
130 if $(HAVE_ZIPPED_MANPAGES); then \
131 $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
132 fi; \
133 u=$$m.$(MAN_SECTION)$$_sfx; \
134 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
135 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
136 else \
137 echo $(INSTALL) -S $$u $${t}$$_sfx; \
138 $(INSTALL) -S $$u $${t}$$_sfx; \
139 fi; \
140 first=false; \
141 done; \
142 done
143
9440d84d
NS
144ifeq ($(ENABLE_GETTEXT),yes)
145INSTALL_LINGUAS = \
146 @for l in $(LINGUAS); do \
147 ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
148 $(INSTALL) -m 755 -d $$ldir; \
149 $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
150 done
151endif
152
3ded4129
NS
153SUBDIRS_MAKERULE = \
154 @for d in $(SUBDIRS) ""; do \
155 if test -d "$$d" -a ! -z "$$d"; then \
156 $(ECHO) === $$d ===; \
157 $(MAKEF) -C $$d $@ || exit $$?; \
158 fi; \
159 done
160
161MAN_MAKERULE = \
162 @for f in *.[12345678] ""; do \
163 if test ! -z "$$f"; then \
164 $(ZIP) --best -c < $$f > $$f.gz; \
165 fi; \
166 done
167
168DIST_MAKERULE = \
169 $(MAKEF) -C build dist
170
171SOURCE_MAKERULE = \
172 @test -z "$$DIR" && DIR="."; \
173 for f in $(SRCFILES) ""; do \
174 if test ! -z "$$f"; then $(ECHO) $$DIR/$$f; fi;\
175 done; \
176 for d in `echo $(SUBDIRS)` ; do \
177 if test -d "$$d" -a ! -z "$$d"; then \
178 $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \
179 fi; \
180 done