2 # Copyright (c) 2002-2005 Silicon Graphics, Inc.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it would be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write the Free Software Foundation,
15 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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).
26 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
28 MAKEOPTS = --no-print-directory
29 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
34 CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
35 DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
37 OBJECTS = $(ASFILES:.s=.o) \
42 INSTALL = $(TOPDIR)/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 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
90 ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
91 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so
93 INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
96 INSTALL_LTLIB_STATIC = \
97 cd $(TOPDIR)/$(LIBNAME)/.libs; \
98 ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
99 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR)
102 @for d in $(MAN_PAGES); do \
105 '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
107 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
108 -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \
110 [ -z "$$m" -o "$$m" = "\\" ] && continue; \
111 t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
113 if $(HAVE_ZIPPED_MANPAGES); then \
114 $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
116 u=$$m.$(MAN_SECTION)$$_sfx; \
117 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
118 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
120 echo $(INSTALL) -S $$u $${t}$$_sfx; \
121 $(INSTALL) -S $$u $${t}$$_sfx; \
127 ifeq ($(ENABLE_GETTEXT),yes)
129 @for l in $(LINGUAS) ""; do \
130 if test -f "$$l.mo" ; then \
131 ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
132 $(INSTALL) -m 755 -d $$ldir; \
133 $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
139 @for d in $(SUBDIRS) ""; do \
140 if test -d "$$d" -a ! -z "$$d"; then \
141 $(ECHO) === $$d ===; \
142 $(MAKEF) -C $$d $@ || exit $$?; \
147 @for f in *.[12345678] ""; do \
148 if test ! -z "$$f"; then \
149 $(ZIP) --best -c < $$f > $$f.gz; \
154 $(MAKEF) -C build dist
157 @test -z "$$DIR" && DIR="."; \
158 for f in $(SRCFILES) ""; do \
159 if test ! -z "$$f"; then $(ECHO) $$DIR/$$f; fi;\
161 for d in `echo $(SUBDIRS)` ; do \
162 if test -d "$$d" -a ! -z "$$d"; then \
163 $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \