Implement basic ‘make install’

This commit is contained in:
Eelco Dolstra 2013-11-23 17:04:27 +00:00
parent d1b3ca0b4a
commit 611868a909
3 changed files with 13 additions and 3 deletions

View file

@ -92,11 +92,19 @@ define PROGRAMS_template =
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src)) _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
$(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs))) $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_NAME)) _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)) $(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. # Propagate CXXFLAGS to the individual object files.
$$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS))) $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS)))

View file

@ -8,7 +8,8 @@ SUBS = \
src/nix-store/Makefile.new \ src/nix-store/Makefile.new \
src/nix-instantiate/Makefile.new \ src/nix-instantiate/Makefile.new \
src/nix-env/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 GLOBAL_CXXFLAGS = -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr

View file

@ -1322,6 +1322,7 @@ void EvalState::createBaseEnv()
/* Add a wrapper around the derivation primop that computes the /* Add a wrapper around the derivation primop that computes the
`drvPath' and `outPath' attributes lazily. */ `drvPath' and `outPath' attributes lazily. */
string path = findFile("nix/derivation.nix"); string path = findFile("nix/derivation.nix");
assert(!path.empty());
sDerivationNix = symbols.create(path); sDerivationNix = symbols.create(path);
evalFile(path, v); evalFile(path, v);
addConstant("derivation", v); addConstant("derivation", v);