b77af1d723faf6dbbbc108ae2bd8b21f5a335cd5
3 ### Makefile for preload-hacks
5 ### (c) 2008 Straylight/Edgeware
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of the preload-hacks package.
12 ### Preload-hacks are free software; you can redistribute it and/or modify
13 ### them under the terms of the GNU General Public License as published by
14 ### the Free Software Foundation; either version 2 of the License, or (at
15 ### your option) any later version.
17 ### Preload-hacks are distributed in the hope that it will be useful, but
18 ### WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
20 ### Public License for more details.
22 ### You should have received a copy of the GNU General Public License along
23 ### with preload-hacks; if not, write to the Free Software Foundation, Inc.,
24 ### 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 PACKAGE
= preload-hacks
28 VERSION
:= $(shell cd
$(srcdir) && .
/auto-version
)
31 .SECONDEXPANSION
: #sorry
33 ###--------------------------------------------------------------------------
36 ## Where to install things.
38 exec_prefix = ${prefix}
39 bindir = ${exec_prefix}/bin
40 libdir = ${exec_prefix}/lib
41 datadir = ${prefix}/share
42 mandir = ${datadir}/man
43 man1dir = ${mandir}/man1
45 ## Private installation tree for packagers.
48 ###--------------------------------------------------------------------------
51 ## Mess with these if you like.
58 INST_BIN
= $(INSTALL
) -c
-m755
59 INST_LIB
= $(INSTALL
) -c
-m644
60 INST_MAN
= $(INSTALL
) -c
-m644
61 INST_BIN
= $(INSTALL
) -c
-m755
62 MKDIRS
= $(INSTALL
) -d
-m755
64 ## Probably best if you leave these alone.
65 REAL_CFLAGS
= $(CFLAGS
) -fPIC
-MD
66 REAL_LDFLAGS
= $(LDFLAGS
) -shared
68 ## Allow user overrides for this stuff.
71 ###--------------------------------------------------------------------------
76 v_tag
= $(call v_tag_
$V,$1)
77 v_tag_0
= @printf
" %-8s %s\n" "$1" "$@";
81 ###--------------------------------------------------------------------------
90 uopen_SOURCES
= uopen.c
93 ALL_SOURCES
= $(foreach h
,$(HACKS
),$($h_SOURCES))
94 DISTFILES
+= $(ALL_SOURCES
)
97 LIBS
+= $(addsuffix .so
, $(HACKS
))
102 TARGETS
+= $(SCRIPTS
)
103 DISTFILES
+= withlib.in
106 MAN1
+= $(addsuffix .1, $(HACKS
))
109 ###--------------------------------------------------------------------------
110 ### Distribution arrangements.
113 distdir
= $(PACKAGE
)-$(VERSION
)
114 DISTTAR
= $(distdir
).
tar.gz
116 ## Distribute the build utilities.
117 DISTFILES
+= Makefile
118 DISTFILES
+= auto-version
128 DISTFILES
+= debian
/changelog debian
/copyright
129 DISTFILES
+= debian
/control debian
/rules debian
/compat
130 DISTFILES
+= debian
/source
/format
131 DISTFILES
+= $(patsubst %, debian
/%.
install, $(debpkg
))
132 DISTFILES
+= $(patsubst %, debian
/%.lintian-overrides
, \
135 ###--------------------------------------------------------------------------
149 $(call v_tag
,CC
)$(CC
) -c
$(REAL_CFLAGS
) $< -o
$@
151 ## Constructing preload hacks.
152 $(addsuffix .so
,$(HACKS
)): %.so
: $$(patsubst %.c
,%.o
,$$($$*_SOURCES
))
153 $(call v_tag
,LD
)$(LD
) $(REAL_LDFLAGS
) $< $(LDLIBS
) -o
$@
155 ## Constructing the scripts.
156 $(SCRIPTS
): %: withlib.in
157 $(call v_tag
,GEN
)sed
"s/@lib@/$@/" $(srcdir)/withlib.in
>$@.new
&& \
158 chmod
+x
$@.new
&& mv
$@.new
$@
160 -include $(patsubst %.c
,%d
,$(ALL_SOURCES
))
162 ###--------------------------------------------------------------------------
166 $(MKDIRS
) $(DESTDIR
)$(bindir)
167 $(INST_BIN
) $(SCRIPTS
) $(DESTDIR
)$(bindir)
168 $(MKDIRS
) $(DESTDIR
)$(libdir)
169 $(INST_BIN
) $(LIBS
) $(DESTDIR
)$(libdir)
170 $(MKDIRS
) $(DESTDIR
)$(man1dir)
171 $(INST_MAN
) $(addprefix $(srcdir)/,$(MAN1
)) $(DESTDIR
)$(man1dir)
175 rm -f
$(addprefix $(DESTDIR
)$(libdir)/, $(LIBS
))
176 rm -f
$(addprefix $(DESTDIR
)$(bindir)/, $(SCRIPTS
))
177 rm -f
$(addprefix $(DESTDIR
)$(man1dir)/, $(MAN1
))
180 ###--------------------------------------------------------------------------
186 echo
$(VERSION
) >$(distdir
)/RELEASE
187 for i in
$(DISTFILES
); do \
190 d
=$${i
%/*} && $(MKDIRS
) $(distdir
)/$$d || exit
1 \
193 cp
$(srcdir)/$$i $(distdir
)/$$i || exit
1; \
198 tar chozf
$(DISTTAR
) $(distdir
)
206 tar xvfz ..
/$(DISTTAR
) && \
207 mkdir _build
&& cd _build
&& \
208 make
-f..
/$(distdir
)/Makefile
srcdir=..
/$(distdir
) && \
209 make
-f..
/$(distdir
)/Makefile
srcdir=..
/$(distdir
) \
210 install DESTDIR
=..
/_install
&& \
211 make
-f..
/$(distdir
)/Makefile
srcdir=..
/$(distdir
) dist
214 ###----- That's all, folks --------------------------------------------------