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)
45 IMAGES_DIR = $(TOPDIR)/all-images
46 DIST_DIR = $(TOPDIR)/dist
48 CCF = $(CC) $(CFLAGS) $(CPPFLAGS)
49 MAKEF = $(MAKE) $(MAKEOPTS)
50 CXXF = $(CXX) $(CXXFLAGS)
53 LIBNAME = $(basename $(LTLIBRARY))
54 LTOBJECTS = $(OBJECTS:.o=.lo)
55 LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
57 LTLINK = $(LIBTOOL) --mode=link $(CC)
58 LTEXEC = $(LIBTOOL) --mode=execute
59 LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
60 LTCOMPILE = $(LIBTOOL) --mode=compile $(CCF)
62 ifeq ($(ENABLE_SHARED),yes)
63 LTLDFLAGS += -rpath $(PKG_LIB_DIR)
64 LTLDFLAGS += -version-info $(LTVERSION)
67 ifeq ($(ENABLE_SHARED),yes)
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)
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
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
81 ifeq ($(ENABLE_SHARED),yes)
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; \
95 INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
98 INSTALL_LTLIB_STATIC = \
99 cd $(TOPDIR)/$(LIBNAME)/.libs; \
100 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR);
103 @for d in $(MAN_PAGES); do \
106 '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
108 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
109 -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \
111 [ -z "$$m" -o "$$m" = "\\" ] && continue; \
112 t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
114 if $(HAVE_ZIPPED_MANPAGES); then \
115 $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
117 u=$$m.$(MAN_SECTION)$$_sfx; \
118 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
119 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
121 echo $(INSTALL) -S $$u $${t}$$_sfx; \
122 $(INSTALL) -S $$u $${t}$$_sfx; \
128 ifeq ($(ENABLE_GETTEXT),yes)
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; \
140 @for f in *.[12345678] ""; do \
141 if test ! -z "$$f"; then \
142 $(ZIP) --best -c < $$f > $$f.gz; \
147 $(MAKEF) -C build dist
150 @test -z "$$DIR" && DIR="."; \
151 for f in $(SRCFILES) ""; do \
152 test -z "$$f" && break; \
153 test -L "$$f" || $(ECHO) $$DIR/$$f; \
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 $$?; \