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 ###--------------------------------------------------------------------------
32 ## Where to install things.
34 exec_prefix = ${prefix}
35 bindir = ${exec_prefix}/bin
36 libdir = ${exec_prefix}/lib
37 datadir = ${prefix}/share
38 mandir = ${datadir}/man
39 man1dir = ${mandir}/man1
41 ## Private installation tree for packagers.
44 ###--------------------------------------------------------------------------
51 V_CC = $(V_CC_$(V))$(CC)
52 V_CC_0 = @echo " CC $@";
55 V_LD = $(V_LD_$(V))$(LD)
56 V_LD_0 = @echo " LD $@";
60 V_GEN_0 = @echo " GEN $@";
62 ###--------------------------------------------------------------------------
65 ## Mess with these if you like.
72 INST_BIN = $(INSTALL) -c -m755
73 INST_LIB = $(INSTALL) -c -m644
74 INST_MAN = $(INSTALL) -c -m644
75 INST_BIN = $(INSTALL) -c -m755
76 MKDIRS = $(INSTALL) -d -m755
78 ## Probably best if you leave these alone.
79 REAL_CFLAGS = $(CFLAGS) -fPIC
80 REAL_LDFLAGS = $(LDFLAGS) -shared
82 ###--------------------------------------------------------------------------
88 DISTFILES += $(NOIP_SOURCES)
92 UOPEN_SOURCES = uopen.c
93 DISTFILES += $(UOPEN_SOURCES)
96 LIBS += $(addsuffix .so, $(HACKS))
101 TARGETS += $(SCRIPTS)
102 DISTFILES += withlib.in
105 MAN1 += $(addsuffix .1, $(HACKS))
108 ###--------------------------------------------------------------------------
109 ### Distribution arrangements.
112 distdir = $(PACKAGE)-$(VERSION)
113 DISTTAR = $(distdir).tar.gz
115 ## Distribute the build utilities.
116 DISTFILES += Makefile
117 DISTFILES += auto-version
127 DISTFILES += debian/changelog debian/copyright
128 DISTFILES += debian/control debian/rules debian/compat
129 DISTFILES += debian/source/format
130 DISTFILES += $(patsubst %, debian/%.install, $(debpkg))
131 DISTFILES += $(patsubst %, debian/%.lintian-overrides, \
134 ###--------------------------------------------------------------------------
146 $(V_CC) -c $(REAL_CFLAGS) $< -o $@
148 ## Constructing preload hacks.
149 noip.so: $(patsubst %.c, %.o, $(NOIP_SOURCES))
150 $(V_LD) $(REAL_LDFLAGS) $< $(LDLIBS) -o $@
151 uopen.so: $(patsubst %.c, %.o, $(UOPEN_SOURCES))
152 $(V_LD) $(REAL_LDFLAGS) $< $(LDLIBS) -o $@
154 ## Constructing the scripts.
155 $(SCRIPTS): %: withlib.in
156 $(V_GEN)sed "s/@lib@/$@/" withlib.in >$@.new && \
157 chmod +x $@.new && mv $@.new $@
159 ###--------------------------------------------------------------------------
163 $(MKDIRS) $(DESTDIR)$(bindir)
164 $(INST_BIN) $(SCRIPTS) $(DESTDIR)$(bindir)
165 $(MKDIRS) $(DESTDIR)$(libdir)
166 $(INST_BIN) $(LIBS) $(DESTDIR)$(libdir)
167 $(MKDIRS) $(DESTDIR)$(man1dir)
168 $(INST_MAN) $(MAN1) $(DESTDIR)$(man1dir)
172 rm -f $(addprefix $(DESTDIR)$(libdir)/, $(LIBS))
173 rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS))
174 rm -f $(addprefix $(DESTDIR)$(man1dir)/, $(MAN1))
177 ###--------------------------------------------------------------------------
183 echo $(VERSION) >$(distdir)/RELEASE
184 for i in $(DISTFILES); do \
187 d=$${i%/*} && $(MKDIRS) $(distdir)/$$d || exit 1 \
190 ln $$i $(distdir)/$$i || exit 1; \
195 tar chozf $(DISTTAR) $(distdir)
203 tar xvfz ../$(DISTTAR) && \
206 make install DESTDIR=../_install && \
210 ###----- That's all, folks --------------------------------------------------