X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/preload-hacks/blobdiff_plain/12545e3d8608753f59c060c6095455f7556fd479..ba98b375ff7fd7c5c848d650d50848c4ef4c1d65:/Makefile diff --git a/Makefile b/Makefile index f1395ff..b77af1d 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,11 @@ ### with preload-hacks; if not, write to the Free Software Foundation, Inc., ### 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +srcdir = . PACKAGE = preload-hacks -VERSION := $(shell ./auto-version) +VERSION := $(shell cd $(srcdir) && ./auto-version) +VPATH = $(srcdir) .SECONDEXPANSION: #sorry ###-------------------------------------------------------------------------- @@ -63,6 +65,9 @@ MKDIRS = $(INSTALL) -d -m755 REAL_CFLAGS = $(CFLAGS) -fPIC -MD REAL_LDFLAGS = $(LDFLAGS) -shared +## Allow user overrides for this stuff. +-include config.mk + ###-------------------------------------------------------------------------- ### Quiet building. @@ -149,7 +154,7 @@ $(addsuffix .so,$(HACKS)): %.so: $$(patsubst %.c,%.o,$$($$*_SOURCES)) ## Constructing the scripts. $(SCRIPTS): %: withlib.in - $(call v_tag,GEN)sed "s/@lib@/$@/" withlib.in >$@.new && \ + $(call v_tag,GEN)sed "s/@lib@/$@/" $(srcdir)/withlib.in >$@.new && \ chmod +x $@.new && mv $@.new $@ -include $(patsubst %.c,%d,$(ALL_SOURCES)) @@ -163,7 +168,7 @@ install: all $(MKDIRS) $(DESTDIR)$(libdir) $(INST_BIN) $(LIBS) $(DESTDIR)$(libdir) $(MKDIRS) $(DESTDIR)$(man1dir) - $(INST_MAN) $(MAN1) $(DESTDIR)$(man1dir) + $(INST_MAN) $(addprefix $(srcdir)/,$(MAN1)) $(DESTDIR)$(man1dir) .PHONY: install uninstall: @@ -185,7 +190,7 @@ distdir: d=$${i%/*} && $(MKDIRS) $(distdir)/$$d || exit 1 \ ;; \ esac; \ - cp $$i $(distdir)/$$i || exit 1; \ + cp $(srcdir)/$$i $(distdir)/$$i || exit 1; \ done .PHONY: distdir @@ -199,10 +204,11 @@ distcheck: dist mkdir _distcheck +cd _distcheck && \ tar xvfz ../$(DISTTAR) && \ - cd $(distdir) && \ - make && \ - make install DESTDIR=../_install && \ - make dist + mkdir _build && cd _build && \ + make -f../$(distdir)/Makefile srcdir=../$(distdir) && \ + make -f../$(distdir)/Makefile srcdir=../$(distdir) \ + install DESTDIR=../_install && \ + make -f../$(distdir)/Makefile srcdir=../$(distdir) dist rm -rf _distcheck ###----- That's all, folks --------------------------------------------------