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.
26 PACKAGE
= preload-hacks
27 VERSION
:= $(shell .
/auto-version
)
29 .SECONDEXPANSION
: #sorry
31 ###--------------------------------------------------------------------------
34 ## Where to install things.
36 exec_prefix = ${prefix}
37 bindir = ${exec_prefix}/bin
38 libdir = ${exec_prefix}/lib
39 datadir = ${prefix}/share
40 mandir = ${datadir}/man
41 man1dir = ${mandir}/man1
43 ## Private installation tree for packagers.
46 ###--------------------------------------------------------------------------
53 V_CC
= $(V_CC_
$(V
))$(CC
)
54 V_CC_0
= @echo
" CC $@";
57 V_LD
= $(V_LD_
$(V
))$(LD
)
58 V_LD_0
= @echo
" LD $@";
62 V_GEN_0
= @echo
" GEN $@";
64 ###--------------------------------------------------------------------------
67 ## Mess with these if you like.
74 INST_BIN
= $(INSTALL
) -c
-m755
75 INST_LIB
= $(INSTALL
) -c
-m644
76 INST_MAN
= $(INSTALL
) -c
-m644
77 INST_BIN
= $(INSTALL
) -c
-m755
78 MKDIRS
= $(INSTALL
) -d
-m755
80 ## Probably best if you leave these alone.
81 REAL_CFLAGS
= $(CFLAGS
) -fPIC
82 REAL_LDFLAGS
= $(LDFLAGS
) -shared
84 ###--------------------------------------------------------------------------
93 uopen_SOURCES
= uopen.c
96 ALL_SOURCES
= $(foreach h
,$(HACKS
),$($h_SOURCES))
97 DISTFILES
+= $(ALL_SOURCES
)
100 LIBS
+= $(addsuffix .so
, $(HACKS
))
105 TARGETS
+= $(SCRIPTS
)
106 DISTFILES
+= withlib.in
109 MAN1
+= $(addsuffix .1, $(HACKS
))
112 ###--------------------------------------------------------------------------
113 ### Distribution arrangements.
116 distdir
= $(PACKAGE
)-$(VERSION
)
117 DISTTAR
= $(distdir
).
tar.gz
119 ## Distribute the build utilities.
120 DISTFILES
+= Makefile
121 DISTFILES
+= auto-version
131 DISTFILES
+= debian
/changelog debian
/copyright
132 DISTFILES
+= debian
/control debian
/rules debian
/compat
133 DISTFILES
+= debian
/source
/format
134 DISTFILES
+= $(patsubst %, debian
/%.
install, $(debpkg
))
135 DISTFILES
+= $(patsubst %, debian
/%.lintian-overrides
, \
138 ###--------------------------------------------------------------------------
150 $(V_CC
) -c
$(REAL_CFLAGS
) $< -o
$@
152 ## Constructing preload hacks.
153 $(addsuffix .so
,$(HACKS
)): %.so
: $$(patsubst %.c
,%.o
,$$($$*_SOURCES
))
154 $(V_LD
) $(REAL_LDFLAGS
) $< $(LDLIBS
) -o
$@
156 ## Constructing the scripts.
157 $(SCRIPTS
): %: withlib.in
158 $(V_GEN
)sed
"s/@lib@/$@/" withlib.in
>$@.new
&& \
159 chmod
+x
$@.new
&& mv
$@.new
$@
161 ###--------------------------------------------------------------------------
165 $(MKDIRS
) $(DESTDIR
)$(bindir)
166 $(INST_BIN
) $(SCRIPTS
) $(DESTDIR
)$(bindir)
167 $(MKDIRS
) $(DESTDIR
)$(libdir)
168 $(INST_BIN
) $(LIBS
) $(DESTDIR
)$(libdir)
169 $(MKDIRS
) $(DESTDIR
)$(man1dir)
170 $(INST_MAN
) $(MAN1
) $(DESTDIR
)$(man1dir)
174 rm -f
$(addprefix $(DESTDIR
)$(libdir)/, $(LIBS
))
175 rm -f
$(addprefix $(DESTDIR
)$(bindir)/, $(SCRIPTS
))
176 rm -f
$(addprefix $(DESTDIR
)$(man1dir)/, $(MAN1
))
179 ###--------------------------------------------------------------------------
185 echo
$(VERSION
) >$(distdir
)/RELEASE
186 for i in
$(DISTFILES
); do \
189 d
=$${i
%/*} && $(MKDIRS
) $(distdir
)/$$d || exit
1 \
192 ln
$$i $(distdir
)/$$i || exit
1; \
197 tar chozf
$(DISTTAR
) $(distdir
)
205 tar xvfz ..
/$(DISTTAR
) && \
208 make
install DESTDIR
=..
/_install
&& \
212 ###----- That's all, folks --------------------------------------------------