]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/buildmacros
split out builddefs into configurable and static parts, should help in
[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
33ifndef _BUILDMACROS_INCLUDED_
34_BUILDMACROS_INCLUDED_ = 1
35
36BUILDRULES = $(TOPDIR)/include/buildrules
37
38# LCFLAGS, LLDFLAGS, LLDLIBS, LSRCFILES and LDIRT may be specified in
39# user Makefiles. Note: LSRCFILES is anything other than Makefile, $(CFILES)
40# $(CXXFILES), or $(HFILES) and is used to construct the manifest list
41# during the "dist" phase (packaging).
42
43LDFLAGS = $(LLDFLAGS)
44LDLIBS = $(LLDLIBS) $(MALLOCLIB)
45
46MAKEOPTS = --no-print-directory
47SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
48DIRT = $(LDIRT) dep dep.bak $(OBJECTS) $(LTOBJECTS) *.[1-9].gz \
49 $(LTCOMMAND) $(LTLIBRARY)
50
51OBJECTS = $(ASFILES:.s=.o) \
52 $(CFILES:.c=.o) \
53 $(LFILES:.l=.o) \
54 $(YFILES:%.y=%.tab.o)
55
56INSTALL = $(TOPDIR)/install-sh -o root -g root
57
58SHELL = /bin/sh
59IMAGES_DIR = $(TOPDIR)/all-images
60DIST_DIR = $(TOPDIR)/dist
61
62CCF = $(CC) $(CFLAGS)
63MAKEF = $(MAKE) $(MAKEOPTS)
64CXXF = $(CXX) $(CXXFLAGS)
65LDF = $(LD) $(LDFLAGS)
66
67# For libtool.
68LIBNAME = $(basename $(LTLIBRARY))
69LTOBJECTS = $(OBJECTS:.o=.lo)
70LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
71
72LTLINK = $(LIBTOOL) --mode=link $(CC)
73LTEXEC = $(LIBTOOL) --mode=execute
74LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
75LTCOMPILE = $(LIBTOOL) --mode=compile $(CCF) -D_REENTRANT -fno-strict-aliasing
76
77ifeq ($(ENABLE_SHARED),yes)
78LTLDFLAGS += -rpath $(PKG_SLIB_DIR)
79LTLDFLAGS += -version-info $(LTVERSION)
80endif
81
82ifeq ($(ENABLE_SHARED),yes)
83INSTALL_LTLIB = \
84 cd $(TOPDIR)/$(LIBNAME)/.libs; \
85 ../$(INSTALL) -m 755 -d $(PKG_SLIB_DIR); \
86 ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_SLIB_DIR); \
87 test "$(PKG_DISTRIBUTION)" = debian || \
88 ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_SLIB_DIR)
89endif
90
91# Libtool thinks the static and shared libs should be in the same dir, so
92# make the static lib appear in the place we chose as rpath (using the two
93# symlinks below).
94# Other things want the shared libs to appear in /usr/lib, else they'll
95# link with the static libs there. So, another symlink to get the .so into
96# /usr/lib.
97ifeq ($(ENABLE_SHARED),yes)
98INSTALL_LTLIB_DEV = \
99 cd $(TOPDIR)/$(LIBNAME)/.libs; \
100 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
101 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_LIB_DIR); \
102 ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_LIB_DIR)/$(LIBNAME).la ; \
103 ../$(INSTALL) -m 755 -d $(PKG_SLIB_DIR); \
104 ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_SLIB_DIR); \
105 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_SLIB_DIR)/$(LIBNAME).a; \
106 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_SLIB_DIR)/$(LIBNAME).la; \
107 ../$(INSTALL) -S $(PKG_SLIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so
108else
109INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
110endif
111
112INSTALL_LTLIB_STATIC = \
113 cd $(TOPDIR)/$(LIBNAME)/.libs; \
114 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
115 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_LIB_DIR)
116
117INSTALL_MAN = \
118 @for d in $(MAN_PAGES); do \
119 first=true; \
120 for m in `$(AWK) \
121 '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
122 | $(SED) \
123 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
124 -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \
125 do \
126 [ -z "$$m" -o "$$m" = "\\" ] && continue; \
127 t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
128 if $$first; then \
129 if $(HAVE_ZIPPED_MANPAGES); then \
130 $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
131 fi; \
132 u=$$m.$(MAN_SECTION)$$_sfx; \
133 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
134 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
135 else \
136 echo $(INSTALL) -S $$u $${t}$$_sfx; \
137 $(INSTALL) -S $$u $${t}$$_sfx; \
138 fi; \
139 first=false; \
140 done; \
141 done
142
143SUBDIRS_MAKERULE = \
144 @for d in $(SUBDIRS) ""; do \
145 if test -d "$$d" -a ! -z "$$d"; then \
146 $(ECHO) === $$d ===; \
147 $(MAKEF) -C $$d $@ || exit $$?; \
148 fi; \
149 done
150
151MAN_MAKERULE = \
152 @for f in *.[12345678] ""; do \
153 if test ! -z "$$f"; then \
154 $(ZIP) --best -c < $$f > $$f.gz; \
155 fi; \
156 done
157
158DIST_MAKERULE = \
159 $(MAKEF) -C build dist
160
161SOURCE_MAKERULE = \
162 @test -z "$$DIR" && DIR="."; \
163 for f in $(SRCFILES) ""; do \
164 if test ! -z "$$f"; then $(ECHO) $$DIR/$$f; fi;\
165 done; \
166 for d in `echo $(SUBDIRS)` ; do \
167 if test -d "$$d" -a ! -z "$$d"; then \
168 $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \
169 fi; \
170 done
171
172endif
173
174#
175# For targets that should always be rebuilt,
176# define a target that is never up-to-date.
177# Targets needing this should depend on $(_FORCE)
178_FORCE = __force_build