]>
Commit | Line | Data |
---|---|---|
3ded4129 | 1 | # |
6e3140c7 | 2 | # Copyright (c) 2002-2003 Silicon Graphics, Inc. All Rights Reserved. |
3ded4129 NS |
3 | # |
4 | ||
3ded4129 NS |
5 | BUILDRULES = $(TOPDIR)/include/buildrules |
6 | ||
7 | # LCFLAGS, LLDFLAGS, LLDLIBS, LSRCFILES and LDIRT may be specified in | |
8 | # user Makefiles. Note: LSRCFILES is anything other than Makefile, $(CFILES) | |
9 | # $(CXXFILES), or $(HFILES) and is used to construct the manifest list | |
10 | # during the "dist" phase (packaging). | |
11 | ||
12 | LDFLAGS = $(LLDFLAGS) | |
93d9f139 | 13 | LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB) |
3ded4129 NS |
14 | |
15 | MAKEOPTS = --no-print-directory | |
16 | SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES) | |
9440d84d NS |
17 | |
18 | DEPDIRT = dep dep.bak | |
19 | MANDIRT = *.[1-9].gz | |
20 | PODIRT = *.tmpo *.mo | |
21 | CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY) | |
22 | DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT) | |
3ded4129 NS |
23 | |
24 | OBJECTS = $(ASFILES:.s=.o) \ | |
dfc130f3 RC |
25 | $(CFILES:.c=.o) \ |
26 | $(LFILES:.l=.o) \ | |
27 | $(YFILES:%.y=%.tab.o) | |
3ded4129 | 28 | |
93d9f139 | 29 | INSTALL = $(TOPDIR)/install-sh -o $(PKG_USER) -g $(PKG_GROUP) |
3ded4129 NS |
30 | |
31 | SHELL = /bin/sh | |
32 | IMAGES_DIR = $(TOPDIR)/all-images | |
33 | DIST_DIR = $(TOPDIR)/dist | |
34 | ||
4e6ff442 | 35 | CCF = $(CC) $(CFLAGS) $(CPPFLAGS) |
3ded4129 NS |
36 | MAKEF = $(MAKE) $(MAKEOPTS) |
37 | CXXF = $(CXX) $(CXXFLAGS) | |
3ded4129 NS |
38 | |
39 | # For libtool. | |
40 | LIBNAME = $(basename $(LTLIBRARY)) | |
41 | LTOBJECTS = $(OBJECTS:.o=.lo) | |
42 | LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) | |
43 | ||
44 | LTLINK = $(LIBTOOL) --mode=link $(CC) | |
45 | LTEXEC = $(LIBTOOL) --mode=execute | |
46 | LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL) | |
062998e3 | 47 | LTCOMPILE = $(LIBTOOL) --mode=compile $(CCF) |
3ded4129 NS |
48 | |
49 | ifeq ($(ENABLE_SHARED),yes) | |
dfc130f3 | 50 | LTLDFLAGS += -rpath $(PKG_LIB_DIR) |
3ded4129 NS |
51 | LTLDFLAGS += -version-info $(LTVERSION) |
52 | endif | |
53 | ||
54 | ifeq ($(ENABLE_SHARED),yes) | |
55 | INSTALL_LTLIB = \ | |
56 | cd $(TOPDIR)/$(LIBNAME)/.libs; \ | |
6c6508ec NS |
57 | ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \ |
58 | ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_LIB_DIR); \ | |
6c6508ec | 59 | ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_LIB_DIR) |
3ded4129 NS |
60 | endif |
61 | ||
62 | # Libtool thinks the static and shared libs should be in the same dir, so | |
63 | # make the static lib appear in the place we chose as rpath (using the two | |
64 | # symlinks below). | |
65 | # Other things want the shared libs to appear in /usr/lib, else they'll | |
66 | # link with the static libs there. So, another symlink to get the .so into | |
67 | # /usr/lib. | |
68 | ifeq ($(ENABLE_SHARED),yes) | |
69 | INSTALL_LTLIB_DEV = \ | |
70 | cd $(TOPDIR)/$(LIBNAME)/.libs; \ | |
6c6508ec NS |
71 | ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \ |
72 | ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \ | |
73 | ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \ | |
3ded4129 | 74 | ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \ |
6c6508ec NS |
75 | ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \ |
76 | ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \ | |
77 | ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \ | |
78 | ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so | |
3ded4129 NS |
79 | else |
80 | INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC) | |
81 | endif | |
82 | ||
83 | INSTALL_LTLIB_STATIC = \ | |
84 | cd $(TOPDIR)/$(LIBNAME)/.libs; \ | |
6c6508ec NS |
85 | ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \ |
86 | ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR) | |
3ded4129 NS |
87 | |
88 | INSTALL_MAN = \ | |
4f3edd9e | 89 | @for d in $(MAN_PAGES); do \ |
3ded4129 NS |
90 | first=true; \ |
91 | for m in `$(AWK) \ | |
92 | '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \ | |
93 | | $(SED) \ | |
94 | -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \ | |
95 | -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \ | |
96 | do \ | |
97 | [ -z "$$m" -o "$$m" = "\\" ] && continue; \ | |
98 | t=$(MAN_DEST)/$$m.$(MAN_SECTION); \ | |
99 | if $$first; then \ | |
100 | if $(HAVE_ZIPPED_MANPAGES); then \ | |
101 | $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \ | |
102 | fi; \ | |
103 | u=$$m.$(MAN_SECTION)$$_sfx; \ | |
104 | echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\ | |
105 | $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \ | |
106 | else \ | |
107 | echo $(INSTALL) -S $$u $${t}$$_sfx; \ | |
108 | $(INSTALL) -S $$u $${t}$$_sfx; \ | |
109 | fi; \ | |
110 | first=false; \ | |
111 | done; \ | |
112 | done | |
113 | ||
9440d84d NS |
114 | ifeq ($(ENABLE_GETTEXT),yes) |
115 | INSTALL_LINGUAS = \ | |
f3e9ba96 SL |
116 | @for l in $(LINGUAS) ""; do \ |
117 | if test -f "$$l.mo" ; then \ | |
118 | ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \ | |
119 | $(INSTALL) -m 755 -d $$ldir; \ | |
120 | $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \ | |
121 | fi; \ | |
9440d84d NS |
122 | done |
123 | endif | |
124 | ||
3ded4129 NS |
125 | SUBDIRS_MAKERULE = \ |
126 | @for d in $(SUBDIRS) ""; do \ | |
127 | if test -d "$$d" -a ! -z "$$d"; then \ | |
128 | $(ECHO) === $$d ===; \ | |
129 | $(MAKEF) -C $$d $@ || exit $$?; \ | |
130 | fi; \ | |
131 | done | |
132 | ||
133 | MAN_MAKERULE = \ | |
134 | @for f in *.[12345678] ""; do \ | |
135 | if test ! -z "$$f"; then \ | |
136 | $(ZIP) --best -c < $$f > $$f.gz; \ | |
137 | fi; \ | |
138 | done | |
139 | ||
140 | DIST_MAKERULE = \ | |
141 | $(MAKEF) -C build dist | |
142 | ||
143 | SOURCE_MAKERULE = \ | |
144 | @test -z "$$DIR" && DIR="."; \ | |
145 | for f in $(SRCFILES) ""; do \ | |
146 | if test ! -z "$$f"; then $(ECHO) $$DIR/$$f; fi;\ | |
147 | done; \ | |
148 | for d in `echo $(SUBDIRS)` ; do \ | |
149 | if test -d "$$d" -a ! -z "$$d"; then \ | |
150 | $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \ | |
151 | fi; \ | |
152 | done |