From b5988004d64d6c533e8bb09732a6f7cd4fb1194f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 12 May 2006 11:47:45 +0000 Subject: [PATCH] * Support for srcdir != builddir (NIX-41). --- Makefile.am | 6 +++--- corepkgs/buildenv/Makefile.am | 2 +- corepkgs/channels/Makefile.am | 2 +- corepkgs/nar/Makefile.am | 2 +- externals/Makefile.am | 6 +++--- misc/emacs/Makefile.am | 2 +- src/boost/format/Makefile.am | 2 +- src/libexpr/Makefile.am | 17 ++++++++--------- src/libmain/Makefile.am | 3 ++- src/libstore/Makefile.am | 10 +++++----- src/libutil/Makefile.am | 2 +- src/nix-env/Makefile.am | 5 +++-- src/nix-hash/Makefile.am | 2 +- src/nix-instantiate/Makefile.am | 5 +++-- src/nix-log2xml/Makefile.am | 2 +- src/nix-store/Makefile.am | 3 ++- 16 files changed, 37 insertions(+), 34 deletions(-) diff --git a/Makefile.am b/Makefile.am index d2f483f11..5734cbd79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,9 +14,9 @@ relname: install-data-local: init-state $(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix - $(INSTALL_DATA) nix.conf.example $(DESTDIR)$(sysconfdir)/nix + $(INSTALL_DATA) $(srcdir)/nix.conf.example $(DESTDIR)$(sysconfdir)/nix if ! test -e $(DESTDIR)$(sysconfdir)/nix/nix.conf; then \ - $(INSTALL_DATA) nix.conf.example $(DESTDIR)$(sysconfdir)/nix/nix.conf; \ + $(INSTALL_DATA) $(srcdir)/nix.conf.example $(DESTDIR)$(sysconfdir)/nix/nix.conf; \ fi if INIT_STATE @@ -50,4 +50,4 @@ svn-revision: all-local: NEWS NEWS: doc/manual/NEWS.txt - cp doc/manual/NEWS.txt NEWS + cp $(srcdir)/doc/manual/NEWS.txt NEWS diff --git a/corepkgs/buildenv/Makefile.am b/corepkgs/buildenv/Makefile.am index 7a5df476d..eeab538ab 100644 --- a/corepkgs/buildenv/Makefile.am +++ b/corepkgs/buildenv/Makefile.am @@ -3,7 +3,7 @@ all-local: builder.pl install-exec-local: $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/buildenv - $(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv + $(INSTALL_DATA) $(srcdir)/default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv $(INSTALL_PROGRAM) builder.pl $(DESTDIR)$(datadir)/nix/corepkgs/buildenv include ../../substitute.mk diff --git a/corepkgs/channels/Makefile.am b/corepkgs/channels/Makefile.am index 44540376d..d4d478f0e 100644 --- a/corepkgs/channels/Makefile.am +++ b/corepkgs/channels/Makefile.am @@ -3,7 +3,7 @@ all-local: unpack.sh install-exec-local: $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/channels - $(INSTALL_DATA) unpack.nix $(DESTDIR)$(datadir)/nix/corepkgs/channels + $(INSTALL_DATA) $(srcdir)/unpack.nix $(DESTDIR)$(datadir)/nix/corepkgs/channels $(INSTALL_PROGRAM) unpack.sh $(DESTDIR)$(datadir)/nix/corepkgs/channels include ../../substitute.mk diff --git a/corepkgs/nar/Makefile.am b/corepkgs/nar/Makefile.am index 741d7e9b3..103051e22 100644 --- a/corepkgs/nar/Makefile.am +++ b/corepkgs/nar/Makefile.am @@ -3,7 +3,7 @@ all-local: nar.sh install-exec-local: $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nar - $(INSTALL_DATA) nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar + $(INSTALL_DATA) $(srcdir)/nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar $(INSTALL_PROGRAM) nar.sh $(DESTDIR)$(datadir)/nix/corepkgs/nar include ../../substitute.mk diff --git a/externals/Makefile.am b/externals/Makefile.am index ae5c91467..32357d206 100644 --- a/externals/Makefile.am +++ b/externals/Makefile.am @@ -10,7 +10,7 @@ $(DB).tar.gz: false $(DB): $(DB).tar.gz - gunzip < $(DB).tar.gz | tar xvf - + gunzip < $(srcdir)/$(DB).tar.gz | tar xvf - have-db: $(MAKE) $(DB) @@ -44,7 +44,7 @@ $(ATERM).tar.gz: false $(ATERM): $(ATERM).tar.gz - gunzip < $(ATERM).tar.gz | tar xvf - + gunzip < $(srcdir)/$(ATERM).tar.gz | tar xvf - have-aterm: $(MAKE) $(ATERM) @@ -76,7 +76,7 @@ $(BZIP2).tar.gz: false $(BZIP2): $(BZIP2).tar.gz - gunzip < $(BZIP2).tar.gz | tar xvf - + gunzip < $(srcdir)/$(BZIP2).tar.gz | tar xvf - have-bzip2: $(MAKE) $(BZIP2) diff --git a/misc/emacs/Makefile.am b/misc/emacs/Makefile.am index 9ca6ec9e3..49f19fe50 100644 --- a/misc/emacs/Makefile.am +++ b/misc/emacs/Makefile.am @@ -2,4 +2,4 @@ EXTRA_DIST = nix-mode.el install-data-local: $(INSTALL) -d $(DESTDIR)$(datadir)/emacs/site-lisp - $(INSTALL_DATA) nix-mode.el $(DESTDIR)$(datadir)/emacs/site-lisp + $(INSTALL_DATA) $(srcdir)/nix-mode.el $(DESTDIR)$(datadir)/emacs/site-lisp diff --git a/src/boost/format/Makefile.am b/src/boost/format/Makefile.am index f89656827..eb4d7dee8 100644 --- a/src/boost/format/Makefile.am +++ b/src/boost/format/Makefile.am @@ -5,4 +5,4 @@ libformat_la_SOURCES = format_implementation.cc free_funcs.cc \ format_fwd.hpp group.hpp internals.hpp internals_fwd.hpp \ macros_default.hpp -AM_CXXFLAGS = -Wall -I../.. +AM_CXXFLAGS = -Wall -I$(srcdir)/../.. diff --git a/src/libexpr/Makefile.am b/src/libexpr/Makefile.am index ad95dff1d..1e77420d5 100644 --- a/src/libexpr/Makefile.am +++ b/src/libexpr/Makefile.am @@ -3,34 +3,33 @@ lib_LTLIBRARIES = libexpr.la libexpr_la_SOURCES = nixexpr.cc nixexpr.hh parser.cc parser.hh \ eval.cc eval.hh primops.cc \ lexer-tab.c lexer-tab.h parser-tab.c parser-tab.h \ - nixexpr-ast.hh \ get-drvs.cc get-drvs.hh +BUILT_SOURCES = nixexpr-ast.cc nixexpr-ast.hh \ + parser-tab.h lexer-tab.h parser-tab.c lexer-tab.c + EXTRA_DIST = lexer.l parser.y nixexpr-ast.def nixexpr-ast.cc AM_CXXFLAGS = \ - -I.. ${bdb_include} ${aterm_include} -I../libutil -I../libstore + -I$(srcdir)/.. ${bdb_include} ${aterm_include} \ + -I$(srcdir)/../libutil -I$(srcdir)/../libstore AM_CFLAGS = \ ${aterm_include} # Parser generation. -parser.cc: parser-tab.h lexer-tab.h - parser-tab.c parser-tab.h: parser.y - $(bison) -v -o parser-tab.c parser.y -d + $(bison) -v -o parser-tab.c $(srcdir)/parser.y -d lexer-tab.c lexer-tab.h: lexer.l - $(flex) --outfile lexer-tab.c --header-file=lexer-tab.h lexer.l + $(flex) --outfile lexer-tab.c --header-file=lexer-tab.h $(srcdir)/lexer.l # ATerm helper function generation. nixexpr-ast.cc nixexpr-ast.hh: ../aterm-helper.pl nixexpr-ast.def - $(perl) ../aterm-helper.pl nixexpr-ast.hh nixexpr-ast.cc < nixexpr-ast.def - -nixexpr.cc nixexpr.hh: nixexpr-ast.hh + $(perl) $(srcdir)/../aterm-helper.pl nixexpr-ast.hh nixexpr-ast.cc < $(srcdir)/nixexpr-ast.def CLEANFILES = diff --git a/src/libmain/Makefile.am b/src/libmain/Makefile.am index 505c9f686..5b90297fe 100644 --- a/src/libmain/Makefile.am +++ b/src/libmain/Makefile.am @@ -9,4 +9,5 @@ AM_CXXFLAGS = \ -DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \ -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \ -DNIX_VERSION=\"$(VERSION)\" \ - -I.. ${aterm_include} -I../libutil -I../libstore + -I$(srcdir)/.. ${aterm_include} -I$(srcdir)/../libutil \ + -I$(srcdir)/../libstore diff --git a/src/libstore/Makefile.am b/src/libstore/Makefile.am index 384f99b9f..c79830d8a 100644 --- a/src/libstore/Makefile.am +++ b/src/libstore/Makefile.am @@ -6,14 +6,14 @@ libstore_la_SOURCES = \ misc.cc misc.hh \ globals.cc globals.hh db.cc db.hh \ references.cc references.hh pathlocks.cc pathlocks.hh \ - gc.cc gc.hh derivations-ast.hh + gc.cc gc.hh + +BUILT_SOURCES = derivations-ast.cc derivations-ast.hh EXTRA_DIST = derivations-ast.def derivations-ast.cc AM_CXXFLAGS = -Wall \ - -I.. ${bdb_include} ${aterm_include} -I../libutil + -I$(srcdir)/.. ${bdb_include} ${aterm_include} -I$(srcdir)/../libutil derivations-ast.cc derivations-ast.hh: ../aterm-helper.pl derivations-ast.def - $(perl) ../aterm-helper.pl derivations-ast.hh derivations-ast.cc < derivations-ast.def - -derivations.cc store.cc: derivations-ast.hh \ No newline at end of file + $(perl) $(srcdir)/../aterm-helper.pl derivations-ast.hh derivations-ast.cc < $(srcdir)/derivations-ast.def diff --git a/src/libutil/Makefile.am b/src/libutil/Makefile.am index e10477deb..8fab0c5b0 100644 --- a/src/libutil/Makefile.am +++ b/src/libutil/Makefile.am @@ -9,4 +9,4 @@ libutil_la_SOURCES += \ md5.c md5.h sha1.c sha1.h sha256.c sha256.h md32_common.h endif -AM_CXXFLAGS = -Wall -I.. ${aterm_include} +AM_CXXFLAGS = -Wall -I$(srcdir)/.. ${aterm_include} diff --git a/src/nix-env/Makefile.am b/src/nix-env/Makefile.am index 02df3057a..5511b2c8e 100644 --- a/src/nix-env/Makefile.am +++ b/src/nix-env/Makefile.am @@ -12,5 +12,6 @@ main.o: help.txt.hh ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) AM_CXXFLAGS = \ - -I.. ${bdb_include} ${aterm_include} -I../libutil -I../libstore \ - -I../libexpr -I../libmain + -I$(srcdir)/.. ${bdb_include} ${aterm_include} \ + -I$(srcdir)/../libutil -I$(srcdir)/../libstore \ + -I$(srcdir)/../libexpr -I$(srcdir)/../libmain -I../libexpr diff --git a/src/nix-hash/Makefile.am b/src/nix-hash/Makefile.am index 571b6157c..1c7eee332 100644 --- a/src/nix-hash/Makefile.am +++ b/src/nix-hash/Makefile.am @@ -10,4 +10,4 @@ nix-hash.o: help.txt.hh ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) AM_CXXFLAGS = \ - -I.. -I../../externals/inst/include -I../libutil -I../libstore -I../libmain + -I$(srcdir)/.. -I$(srcdir)/../libutil -I$(srcdir)/../libstore -I$(srcdir)/../libmain diff --git a/src/nix-instantiate/Makefile.am b/src/nix-instantiate/Makefile.am index 23f4fbf56..d1a87986f 100644 --- a/src/nix-instantiate/Makefile.am +++ b/src/nix-instantiate/Makefile.am @@ -11,5 +11,6 @@ main.o: help.txt.hh ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) AM_CXXFLAGS = \ - -I.. ${bdb_include} ${aterm_include} -I../libutil -I../libstore \ - -I../libexpr -I../libmain + ${bdb_include} ${aterm_include} \ + -I$(srcdir)/.. -I$(srcdir)/../libutil -I$(srcdir)/../libstore \ + -I$(srcdir)/../libexpr -I$(srcdir)/../libmain -I../libexpr diff --git a/src/nix-log2xml/Makefile.am b/src/nix-log2xml/Makefile.am index 4b6c76c24..c538fda08 100644 --- a/src/nix-log2xml/Makefile.am +++ b/src/nix-log2xml/Makefile.am @@ -8,7 +8,7 @@ nix_log2xml_SOURCES = log2xml.cc %.html: %.xml mark-errors.xsl log2html.xsl $(xsltproc) mark-errors.xsl $< | $(xsltproc) log2html.xsl - > $@ -LOG2HTML = mark-errors.xsl log2html.xsl treebits.js +LOG2HTML = $(srcdir)/mark-errors.xsl $(srcdir)/log2html.xsl $(srcdir)/treebits.js EXTRA_DIST = $(LOG2HTML) diff --git a/src/nix-store/Makefile.am b/src/nix-store/Makefile.am index 5cfa52e5e..83fa24fca 100644 --- a/src/nix-store/Makefile.am +++ b/src/nix-store/Makefile.am @@ -10,4 +10,5 @@ main.o: help.txt.hh ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) AM_CXXFLAGS = \ - -I.. ${bdb_include} $(aterm_include) -I../libutil -I../libstore -I../libmain + -I$(srcdir)/.. ${bdb_include} $(aterm_include) -I$(srcdir)/../libutil \ + -I$(srcdir)/../libstore -I$(srcdir)/../libmain