2 # Copyright (c) 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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/>.
18 BUILDRULES = $(TOPDIR)/include/buildrules
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).
25 LDFLAGS += $(LOADERFLAGS) $(LLDFLAGS)
26 LTLDFLAGS += $(LOADERFLAGS)
27 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
29 MAKEOPTS = --no-print-directory
30 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
35 CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
36 DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
38 OBJECTS = $(ASFILES:.s=.o) \
43 INSTALL = $(TOPDIR)/include/install-sh -o $(PKG_USER) -g $(PKG_GROUP)
46 IMAGES_DIR = $(TOPDIR)/all-images
47 DIST_DIR = $(TOPDIR)/dist
49 CCF = $(CC) $(CFLAGS) $(CPPFLAGS)
50 MAKEF = $(MAKE) $(MAKEOPTS)
51 CXXF = $(CXX) $(CXXFLAGS)
54 LIBNAME = $(basename $(LTLIBRARY))
55 LTOBJECTS = $(OBJECTS:.o=.lo)
56 LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
58 LTLINK = $(LIBTOOL) --mode=link $(CC)
59 LTEXEC = $(LIBTOOL) --mode=execute
60 LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
61 LTCOMPILE = $(LIBTOOL) --mode=compile $(CCF)
63 ifeq ($(ENABLE_SHARED),yes)
64 LTLDFLAGS += -rpath $(PKG_LIB_DIR)
65 LTLDFLAGS += -version-info $(LTVERSION)
68 ifeq ($(ENABLE_SHARED),yes)
70 cd $(TOPDIR)/$(LIBNAME)/.libs; \
71 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
72 ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_LIB_DIR); \
73 ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_LIB_DIR)
76 # Libtool thinks the static and shared libs should be in the same dir, so
77 # make the static lib appear in the place we chose as rpath (using the two
79 # Other things want the shared libs to appear in /usr/lib, else they'll
80 # link with the static libs there. So, another symlink to get the .so into
82 ifeq ($(ENABLE_SHARED),yes)
84 cd $(TOPDIR)/$(LIBNAME)/.libs; \
85 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
86 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \
87 ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \
88 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
89 ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \
90 if test "x$(PKG_DEVLIB_DIR)" != "x$(PKG_LIB_DIR)" ; then \
91 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
92 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
93 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so; \
96 INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
99 INSTALL_LTLIB_STATIC = \
100 cd $(TOPDIR)/$(LIBNAME)/.libs; \
101 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
102 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR)
105 @for d in $(MAN_PAGES); do \
108 '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
110 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
111 -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \
113 [ -z "$$m" -o "$$m" = "\\" ] && continue; \
114 t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
116 if $(HAVE_ZIPPED_MANPAGES); then \
117 $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
119 u=$$m.$(MAN_SECTION)$$_sfx; \
120 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
121 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
123 echo $(INSTALL) -S $$u $${t}$$_sfx; \
124 $(INSTALL) -S $$u $${t}$$_sfx; \
130 ifeq ($(ENABLE_GETTEXT),yes)
132 @for l in $(LINGUAS) ""; do \
133 if test -f "$$l.mo" ; then \
134 ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
135 $(INSTALL) -m 755 -d $$ldir; \
136 $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
142 @for f in *.[12345678] ""; do \
143 if test ! -z "$$f"; then \
144 $(ZIP) --best -c < $$f > $$f.gz; \
149 $(MAKEF) -C build dist
152 @test -z "$$DIR" && DIR="."; \
153 for f in $(SRCFILES) ""; do \
154 test -z "$$f" && break; \
155 test -L "$$f" || $(ECHO) $$DIR/$$f; \
157 for d in `echo $(SUBDIRS)` ""; do \
158 test -z "$$d" && break; \
159 if test -d "$$d"; then \
160 $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \