]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/buildmacros
xfsprogs: Release v6.7.0
[thirdparty/xfsprogs-dev.git] / include / buildmacros
1 # SPDX-License-Identifier: GPL-2.0
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 += $(SANITIZER_LDFLAGS) $(LOADERFLAGS) $(LLDFLAGS)
13 LTLDFLAGS += $(LOADERFLAGS)
14 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
15
16 MAKEOPTS = --no-print-directory Q=$(Q)
17 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
18 SRCFILES += $(QAHFILES)
19
20 DEPDIRT = dep dep.bak
21 MANDIRT = *.[1-9].gz
22 PODIRT = *.tmpo *.mo
23 CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
24 DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
25 LIBDIRT = .libs
26 DIRDIRT = $(LDIRDIRT) $(LIBDIRT)
27
28 OBJECTS = $(ASFILES:.s=.o) \
29 $(CFILES:.c=.o) \
30 $(LFILES:.l=.o) \
31 $(YFILES:%.y=%.tab.o)
32
33 INSTALL = $(TOPDIR)/install-sh -o $(PKG_USER) -g $(PKG_GROUP)
34
35 IMAGES_DIR = $(TOPDIR)/all-images
36 DIST_DIR = $(TOPDIR)/dist
37
38 CCF = $(CC) $(CFLAGS) $(CPPFLAGS)
39 MAKEF = $(MAKE) $(MAKEOPTS)
40 CXXF = $(CXX) $(CXXFLAGS)
41
42 # For libtool.
43 LIBNAME = $(basename $(LTLIBRARY))
44 LTOBJECTS = $(OBJECTS:.o=.lo)
45 LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
46
47 LTLINK = $(LIBTOOL) --quiet --tag=CC --mode=link $(CC)
48 LTEXEC = $(LIBTOOL) --quiet --mode=execute
49 LTINSTALL = $(LIBTOOL) --quiet --mode=install $(INSTALL)
50 LTCOMPILE = $(LIBTOOL) --quiet --tag=CC --mode=compile $(CCF)
51
52 ifeq ($(ENABLE_SHARED),yes)
53 LTLDFLAGS += -rpath $(PKG_ROOT_LIB_DIR)
54 LTLDFLAGS += -version-info $(LTVERSION)
55 endif
56
57 ifeq ($(ENABLE_SHARED),yes)
58 INSTALL_LTLIB = \
59 cd $(TOPDIR)/$(LIBNAME)/.libs; \
60 ../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \
61 ../$(INSTALL) -m 755 -T so_dot_version $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \
62 ../$(INSTALL) -T so_dot_current $(LIBNAME).lai $(PKG_ROOT_LIB_DIR)
63 endif
64
65 # Libtool thinks the static and shared libs should be in the same dir, so
66 # make the static lib appear in the place we chose as rpath (using the two
67 # symlinks below).
68 # Other things want the shared libs to appear in /usr/lib, else they'll
69 # link with the static libs there. So, another symlink to get the .so into
70 # /usr/lib.
71 ifeq ($(ENABLE_SHARED),yes)
72 INSTALL_LTLIB_DEV = \
73 cd $(TOPDIR)/$(LIBNAME)/.libs; \
74 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
75 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_LIB_DIR); \
76 ../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_LIB_DIR)/$(LIBNAME).la ; \
77 ../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \
78 ../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \
79 if [ "x$(shell readlink -f $(PKG_LIB_DIR))" != \
80 "x$(shell readlink -f $(PKG_ROOT_LIB_DIR))" ]; then \
81 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_ROOT_LIB_DIR)/$(LIBNAME).a; \
82 ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \
83 ../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \
84 fi
85 else
86 INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
87 endif
88
89 INSTALL_LTLIB_STATIC = \
90 cd $(TOPDIR)/$(LIBNAME)/.libs; \
91 ../$(INSTALL) -m 755 -d $(PKG_LIB_DIR); \
92 ../$(INSTALL) -m 644 -T old_lib $(LIBNAME).lai $(PKG_LIB_DIR)
93
94 INSTALL_MAN = \
95 @for d in $(MAN_PAGES); do \
96 first=true; \
97 for m in `$(AWK) \
98 '/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
99 | $(SED) \
100 -e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
101 -e 's/\\\f[0-9]//g' -e 's/ / /g;q'`; \
102 do \
103 [ -z "$$m" -o "$$m" = "\\" ] && continue; \
104 t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
105 if $$first; then \
106 if $(HAVE_ZIPPED_MANPAGES); then \
107 $(ZIP) -9 -c $$d > $$d.gz; _sfx=.gz; \
108 fi; \
109 u=$$m.$(MAN_SECTION)$$_sfx; \
110 echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx;\
111 $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
112 else \
113 echo $(INSTALL) -S $$u $${t}$$_sfx; \
114 $(INSTALL) -S $$u $${t}$$_sfx; \
115 fi; \
116 first=false; \
117 done; \
118 done
119
120 ifeq ($(ENABLE_GETTEXT),yes)
121 INSTALL_LINGUAS = \
122 @for l in $(LINGUAS) ""; do \
123 if test -f "$$l.mo" ; then \
124 ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
125 $(INSTALL) -m 755 -d $$ldir; \
126 $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
127 fi; \
128 done
129 endif
130
131 MAN_MAKERULE = \
132 @for f in *.[12345678] ""; do \
133 if test ! -z "$$f"; then \
134 $(ZIP) --best -c < $$f > $$f.gz; \
135 fi; \
136 done