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 distributed in the hope that it will be useful, but WITHOUT
18 ### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 ### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
22 ### You should have received a copy of the GNU General Public License along
23 ### with mLib; if not, write to the Free Software Foundation, Inc., 59 Temple
24 ### 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 ###--------------------------------------------------------------------------
47 ## Mess with these if you like.
54 INST_BIN = $(INSTALL) -c -m755
55 INST_LIB = $(INSTALL) -c -m644
56 INST_MAN = $(INSTALL) -c -m644
57 INST_BIN = $(INSTALL) -c -m755
58 MKDIRS = $(INSTALL) -d -m755
60 ## Probably best if you leave these alone.
61 REAL_CFLAGS = $(CFLAGS) -fPIC
62 REAL_LDFLAGS = $(LDFLAGS) -shared
64 ###--------------------------------------------------------------------------
70 DISTFILES += $(NOIP_SOURCES)
74 UOPEN_SOURCES = uopen.c
75 DISTFILES += $(UOPEN_SOURCES)
78 LIBS += $(addsuffix .so, $(HACKS))
84 DISTFILES += withlib.in
87 MAN1 += $(addsuffix .1, $(HACKS))
90 ###--------------------------------------------------------------------------
91 ### Distribution arrangements.
94 distdir = $(PACKAGE)-$(VERSION)
95 DISTTAR = $(distdir).tar.gz
97 ## Distribute the build utilities.
99 DISTFILES += auto-version
109 DISTFILES += debian/changelog debian/copyright
110 DISTFILES += debian/control debian/rules
111 DISTFILES += $(patsubst %, debian/%.install, $(debpkg))
112 DISTFILES += $(patsubst %, debian/%.lintian-overrides, \
115 ###--------------------------------------------------------------------------
127 $(CC) -c $(REAL_CFLAGS) $< -o $@
129 ## Constructing preload hacks.
130 noip.so: $(patsubst %.c, %.o, $(NOIP_SOURCES))
131 $(LD) $(REAL_LDFLAGS) $< $(LDLIBS) -o $@
132 uopen.so: $(patsubst %.c, %.o, $(UOPEN_SOURCES))
133 $(LD) $(REAL_LDFLAGS) $< $(LDLIBS) -o $@
135 ## Constructing the scripts.
136 $(SCRIPTS): withlib.in
137 for i in $(SCRIPTS); do \
138 sed "s/@lib@/$$i/" withlib.in >$$i.new || exit 1; \
139 chmod +x $$i.new || exit 1; \
140 mv $$i.new $$i || exit 1; \
143 ###--------------------------------------------------------------------------
147 $(MKDIRS) $(DESTDIR)$(bindir)
148 $(INST_BIN) $(SCRIPTS) $(DESTDIR)$(bindir)
149 $(MKDIRS) $(DESTDIR)$(libdir)
150 $(INST_BIN) $(LIBS) $(DESTDIR)$(libdir)
151 $(MKDIRS) $(DESTDIR)$(man1dir)
152 $(INST_MAN) $(MAN1) $(DESTDIR)$(man1dir)
156 rm -f $(addprefix $(DESTDIR)$(libdir)/, $(LIBS))
157 rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS))
158 rm -f $(addprefix $(DESTDIR)$(man1dir)/, $(MAN1))
161 ###--------------------------------------------------------------------------
167 echo $(VERSION) >$(distdir)/RELEASE
168 for i in $(DISTFILES); do \
171 d=$${i%/*} && $(MKDIRS) $(distdir)/$$d || exit 1 \
174 ln $$i $(distdir)/$$i || exit 1; \
179 tar chozf $(DISTTAR) $(distdir)
187 tar xvfz ../$(DISTTAR) && \
190 make install DESTDIR=../_install && \
194 ###----- That's all, folks --------------------------------------------------