bump to 2.2.52
[platform/upstream/acl.git] / include / buildmacros
1 #
2 # Copyright (c) 2002-2003 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 the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
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 += $(LOADERFLAGS) $(LLDFLAGS)
26 LTLDFLAGS += $(LOADERFLAGS)
27 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
28
29 MAKEOPTS = --no-print-directory
30 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
31
32 DEPDIRT = dep dep.bak
33 MANDIRT = *.[1-9].gz
34 PODIRT = *.tmpo *.mo
35 CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
36 DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
37
38 OBJECTS = $(ASFILES:.s=.o) \
39           $(CFILES:.c=.o) \
40           $(LFILES:.l=.o) \
41           $(YFILES:%.y=%.tab.o)
42
43 INSTALL = $(TOPDIR)/include/install-sh -o $(PKG_USER) -g $(PKG_GROUP)
44
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         if test "x$(PKG_DEVLIB_DIR)" != "x$(PKG_LIB_DIR)" ; then \
90         ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
91         ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
92         ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so; \
93         fi
94 else
95 INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
96 endif
97
98 INSTALL_LTLIB_STATIC = \
99         cd $(TOPDIR)/$(LIBNAME)/.libs; \
100         ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR);
101
102 INSTALL_MAN = \
103         @for d in $(MAN_PAGES); do \
104                 first=true; \
105                 for m in `$(AWK) \
106                         '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
107                         | $(SED) \
108                                 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
109                                 -e 's/\\\f[0-9]//g' -e 's/  / /g;q'`; \
110                 do \
111                         [ -z "$$m" -o "$$m" = "\\" ] && continue; \
112                         t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
113                         if $$first; then \
114                                 if $(HAVE_ZIPPED_MANPAGES); then \
115                                         $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
116                                 fi; \
117                                 u=$$m.$(MAN_SECTION)$$_sfx; \
118                                 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
119                                 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
120                         else \
121                                 echo $(INSTALL) -S $$u $${t}$$_sfx; \
122                                 $(INSTALL) -S $$u $${t}$$_sfx; \
123                         fi; \
124                         first=false; \
125                 done; \
126         done
127
128 ifeq ($(ENABLE_GETTEXT),yes)
129 INSTALL_LINGUAS = \
130         @for l in $(LINGUAS) ""; do \
131                 if test -f "$$l.mo" ; then \
132                         ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
133                         $(INSTALL) -m 755 -d $$ldir; \
134                         $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
135                 fi; \
136         done
137 endif
138
139 MAN_MAKERULE = \
140         @for f in *.[12345678] ""; do \
141                 if test ! -z "$$f"; then \
142                         $(ZIP) --best -c < $$f > $$f.gz; \
143                 fi; \
144         done
145
146 DIST_MAKERULE = \
147         $(MAKEF) -C build dist
148
149 SOURCE_MAKERULE = \
150         @test -z "$$DIR" && DIR="."; \
151         for f in $(SRCFILES) ""; do \
152             test -z "$$f" && break; \
153             test -L "$$f" || $(ECHO) $$DIR/$$f; \
154         done; \
155         for d in `echo $(SUBDIRS)` ""; do \
156             test -z "$$d" && break; \
157             if test -d "$$d"; then \
158                 $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \
159             fi; \
160         done