Added qa machine hellfire to common.config
[xfstests-dev.git] / include / buildmacros
1 #
2 # Copyright (c) 2002-2003 Silicon Graphics, Inc.  All Rights Reserved.
3 #
4
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)
13 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
14
15 MAKEOPTS = --no-print-directory
16 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
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)
23
24 OBJECTS = $(ASFILES:.s=.o) \
25           $(CFILES:.c=.o) \
26           $(LFILES:.l=.o) \
27           $(YFILES:%.y=%.tab.o)
28
29 INSTALL = $(TOPDIR)/install-sh -o $(PKG_USER) -g $(PKG_GROUP)
30
31 SHELL = /bin/sh
32 IMAGES_DIR = $(TOPDIR)/all-images
33 DIST_DIR = $(TOPDIR)/dist
34
35 CCF     = $(CC) $(CFLAGS) $(CPPFLAGS)
36 MAKEF   = $(MAKE) $(MAKEOPTS)
37 CXXF    = $(CXX) $(CXXFLAGS)
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)
47 LTCOMPILE = $(LIBTOOL) --mode=compile $(CCF)
48
49 ifeq ($(ENABLE_SHARED),yes)
50 LTLDFLAGS += -rpath $(PKG_LIB_DIR)
51 LTLDFLAGS += -version-info $(LTVERSION)
52 endif
53
54 ifeq ($(ENABLE_SHARED),yes)
55 INSTALL_LTLIB = \
56         cd $(TOPDIR)/$(LIBNAME)/.libs; \
57         ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
58         ../$(INSTALL) -m 644 -T so_dot_version $(LIBNAME).lai $(PKG_LIB_DIR); \
59         test "$(PKG_DISTRIBUTION)" = debian || \
60         ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_LIB_DIR)
61 endif
62
63 # Libtool thinks the static and shared libs should be in the same dir, so
64 # make the static lib appear in the place we chose as rpath (using the two
65 # symlinks below).
66 # Other things want the shared libs to appear in /usr/lib, else they'll
67 # link with the static libs there.  So, another symlink to get the .so into
68 # /usr/lib.
69 ifeq ($(ENABLE_SHARED),yes)
70 INSTALL_LTLIB_DEV = \
71         cd $(TOPDIR)/$(LIBNAME)/.libs; \
72         ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
73         ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR); \
74         ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_DEVLIB_DIR)/$(LIBNAME).la ; \
75         ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
76         ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_LIB_DIR); \
77         ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).a $(PKG_LIB_DIR)/$(LIBNAME).a; \
78         ../$(INSTALL) -S $(PKG_DEVLIB_DIR)/$(LIBNAME).la $(PKG_LIB_DIR)/$(LIBNAME).la; \
79         ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).so $(PKG_DEVLIB_DIR)/$(LIBNAME).so
80 else
81 INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
82 endif
83
84 INSTALL_LTLIB_STATIC = \
85         cd $(TOPDIR)/$(LIBNAME)/.libs; \
86         ../$(INSTALL) -m 755 -d $(PKG_DEVLIB_DIR); \
87         ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_DEVLIB_DIR)
88
89 INSTALL_MAN = \
90         @for d in $(MAN_PAGES); do \
91                 first=true; \
92                 for m in `$(AWK) \
93                         '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
94                         | $(SED) \
95                                 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
96                                 -e 's/\\\f[0-9]//g' -e 's/  / /g;q'`; \
97                 do \
98                         [ -z "$$m" -o "$$m" = "\\" ] && continue; \
99                         t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
100                         if $$first; then \
101                                 if $(HAVE_ZIPPED_MANPAGES); then \
102                                         $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
103                                 fi; \
104                                 u=$$m.$(MAN_SECTION)$$_sfx; \
105                                 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
106                                 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
107                         else \
108                                 echo $(INSTALL) -S $$u $${t}$$_sfx; \
109                                 $(INSTALL) -S $$u $${t}$$_sfx; \
110                         fi; \
111                         first=false; \
112                 done; \
113         done
114
115 ifeq ($(ENABLE_GETTEXT),yes)
116 INSTALL_LINGUAS = \
117         @for l in $(LINGUAS) ""; do \
118                 if test -f "$$l.mo" ; then \
119                         ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
120                         $(INSTALL) -m 755 -d $$ldir; \
121                         $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
122                 fi; \
123         done
124 endif
125
126 SUBDIRS_MAKERULE = \
127         @for d in $(SUBDIRS) ""; do \
128                 if test -d "$$d" -a ! -z "$$d"; then \
129                         $(ECHO) === $$d ===; \
130                         $(MAKEF) -C $$d $@ || exit $$?; \
131                 fi; \
132         done
133
134 MAN_MAKERULE = \
135         @for f in *.[12345678] ""; do \
136                 if test ! -z "$$f"; then \
137                         $(ZIP) --best -c < $$f > $$f.gz; \
138                 fi; \
139         done
140
141 DIST_MAKERULE = \
142         $(MAKEF) -C build dist
143
144 SOURCE_MAKERULE = \
145         @test -z "$$DIR" && DIR="."; \
146         for f in $(SRCFILES) ""; do \
147             if test ! -z "$$f"; then $(ECHO) $$DIR/$$f; fi;\
148         done; \
149         for d in `echo $(SUBDIRS)` ; do \
150             if test -d "$$d" -a ! -z "$$d"; then \
151                 $(MAKEF) DIR=$$DIR/$$d -C $$d $@ || exit $$?; \
152             fi; \
153         done