From 611868a90904ac233d8476682a4618fdd8c78c50 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 23 Nov 2013 17:04:27 +0000 Subject: [PATCH] =?UTF-8?q?Implement=20basic=20=E2=80=98make=20install?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile.lib | 12 ++++++++++-- Makefile.new | 3 ++- src/libexpr/primops.cc | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile.lib b/Makefile.lib index d197fa6c1..1c4ada9c2 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -92,11 +92,19 @@ define PROGRAMS_template = _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src)) $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs))) _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_NAME)) - _prog := $$(_d)/$(1) + $(1)_PATH := $$(_d)/$(1) - $$(_prog): $$($(1)_OBJS) $$(_libs) + $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) $(QUIET) $(CXX) -o $$@ -Wl,--no-copy-dt-needed-entries $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) + $(1)_INSTALL_PATH := $$(bindir)/$(1) + + $$($(1)_INSTALL_PATH): $$($(1)_PATH) + mkdir -p $$(dir $$@) + cp $$< $$@ + + install:: $$($(1)_INSTALL_PATH) + # Propagate CXXFLAGS to the individual object files. $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS))) diff --git a/Makefile.new b/Makefile.new index 1ae88d42f..646f43848 100644 --- a/Makefile.new +++ b/Makefile.new @@ -8,7 +8,8 @@ SUBS = \ src/nix-store/Makefile.new \ src/nix-instantiate/Makefile.new \ src/nix-env/Makefile.new \ - src/nix-daemon/Makefile.new + src/nix-daemon/Makefile.new \ + corepkgs/Makefile.new GLOBAL_CXXFLAGS = -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 9c9d202ed..bb6739d20 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1322,6 +1322,7 @@ void EvalState::createBaseEnv() /* Add a wrapper around the derivation primop that computes the `drvPath' and `outPath' attributes lazily. */ string path = findFile("nix/derivation.nix"); + assert(!path.empty()); sDerivationNix = symbols.create(path); evalFile(path, v); addConstant("derivation", v);