Rename $(here) to $(d) for brevity, and remove trailing slash
This commit is contained in:
parent
9a14d5e2f3
commit
754c05ed6c
12 changed files with 49 additions and 39 deletions
26
Makefile.lib
26
Makefile.lib
|
@ -1,3 +1,15 @@
|
||||||
|
default: all
|
||||||
|
|
||||||
|
|
||||||
|
# Include all sub-Makefiles.
|
||||||
|
define include_sub_makefile =
|
||||||
|
d := $$(patsubst %/, %, $$(dir $(1)))
|
||||||
|
include $(1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach mf, $(SUBS), $(eval $(call include_sub_makefile, $(mf))))
|
||||||
|
|
||||||
|
|
||||||
# Include Autoconf variables.
|
# Include Autoconf variables.
|
||||||
Makefile.config: Makefile.config.in
|
Makefile.config: Makefile.config.in
|
||||||
./config.status
|
./config.status
|
||||||
|
@ -22,10 +34,10 @@ libs_list :=
|
||||||
|
|
||||||
define LIBS_template =
|
define LIBS_template =
|
||||||
_d := $$($(1)_DIR)
|
_d := $$($(1)_DIR)
|
||||||
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(src))
|
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
|
||||||
_objs := $$(addsuffix .o, $$(basename $$(_srcs)))
|
_objs := $$(addsuffix .o, $$(basename $$(_srcs)))
|
||||||
_libs := $$(foreach lib, $$($(1)_LIBS), $$(lib).a)
|
_libs := $$(foreach lib, $$($(1)_LIBS), $$(lib).a)
|
||||||
_lib := $$(_d)$(1).a
|
_lib := $$(_d)/$(1).a
|
||||||
|
|
||||||
$$(_lib): $$(_objs)
|
$$(_lib): $$(_objs)
|
||||||
$(QUIET) ar crs $$@ $$?
|
$(QUIET) ar crs $$@ $$?
|
||||||
|
@ -36,7 +48,7 @@ define LIBS_template =
|
||||||
include $$(wildcard $$(_d)/*.dep)
|
include $$(wildcard $$(_d)/*.dep)
|
||||||
|
|
||||||
libs_list += $$(_lib)
|
libs_list += $$(_lib)
|
||||||
clean_list += $$(_d)*.a $$(_d)*.o $$(_d)*.dep
|
clean_list += $$(_d)/*.a $$(_d)/*.o $$(_d)/*.dep
|
||||||
dist_files += $$(_srcs)
|
dist_files += $$(_srcs)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -48,10 +60,10 @@ programs_list :=
|
||||||
|
|
||||||
define PROGRAMS_template =
|
define PROGRAMS_template =
|
||||||
_d := $$($(1)_DIR)
|
_d := $$($(1)_DIR)
|
||||||
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(src))
|
_srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
|
||||||
_objs := $$(addsuffix .o, $$(basename $$(_srcs)))
|
_objs := $$(addsuffix .o, $$(basename $$(_srcs)))
|
||||||
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_DIR)$$(lib).a)
|
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_DIR)/$$(lib).a)
|
||||||
_prog := $$(_d)$(1)
|
_prog := $$(_d)/$(1)
|
||||||
|
|
||||||
$$(_prog): $$(_objs) $$(_libs)
|
$$(_prog): $$(_objs) $$(_libs)
|
||||||
$(QUIET) g++ -o $$@ $$^ $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS))
|
$(QUIET) g++ -o $$@ $$^ $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS))
|
||||||
|
@ -62,7 +74,7 @@ define PROGRAMS_template =
|
||||||
include $$(wildcard $$(_d)/*.dep)
|
include $$(wildcard $$(_d)/*.dep)
|
||||||
|
|
||||||
programs_list += $$(_prog)
|
programs_list += $$(_prog)
|
||||||
clean_list += $$(_prog) $$(_d)*.o $$(_d)*.dep
|
clean_list += $$(_prog) $$(_d)/*.o $$(_d)/*.dep
|
||||||
dist_files += $$(_srcs)
|
dist_files += $$(_srcs)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
27
Makefile.new
27
Makefile.new
|
@ -1,18 +1,15 @@
|
||||||
default: all
|
SUBS = \
|
||||||
|
src/boost/format/Makefile.new \
|
||||||
here = $(dir $(lastword $(MAKEFILE_LIST)))
|
src/libutil/Makefile.new \
|
||||||
|
src/libstore/Makefile.new \
|
||||||
include src/boost/format/Makefile.new
|
src/libmain/Makefile.new \
|
||||||
include src/libutil/Makefile.new
|
src/libexpr/Makefile.new \
|
||||||
include src/libstore/Makefile.new
|
src/nix-hash/Makefile.new \
|
||||||
include src/libmain/Makefile.new
|
src/nix-store/Makefile.new \
|
||||||
include src/libexpr/Makefile.new
|
src/nix-instantiate/Makefile.new \
|
||||||
include src/nix-hash/Makefile.new
|
src/nix-env/Makefile.new \
|
||||||
include src/nix-store/Makefile.new
|
src/nix-daemon/Makefile.new
|
||||||
include src/nix-instantiate/Makefile.new
|
|
||||||
include src/nix-env/Makefile.new
|
|
||||||
include src/nix-daemon/Makefile.new
|
|
||||||
|
|
||||||
include Makefile.lib
|
include Makefile.lib
|
||||||
|
|
||||||
CXXFLAGS += -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr
|
CXXFLAGS += -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr -O0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
LIBS += libformat
|
LIBS += libformat
|
||||||
|
|
||||||
libformat_DIR := $(here)
|
libformat_DIR := $(d)
|
||||||
|
|
||||||
libformat_SOURCES = format_implementation.cc free_funcs.cc parsing.cc
|
libformat_SOURCES = format_implementation.cc free_funcs.cc parsing.cc
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
LIBS += libexpr
|
LIBS += libexpr
|
||||||
|
|
||||||
libexpr_DIR := $(here)
|
libexpr_DIR := $(d)
|
||||||
|
|
||||||
libexpr_SOURCES = \
|
libexpr_SOURCES = \
|
||||||
nixexpr.cc eval.cc primops.cc lexer-tab.cc parser-tab.cc \
|
nixexpr.cc eval.cc primops.cc lexer-tab.cc parser-tab.cc \
|
||||||
get-drvs.cc attr-path.cc value-to-xml.cc value-to-json.cc \
|
get-drvs.cc attr-path.cc value-to-xml.cc value-to-json.cc \
|
||||||
common-opts.cc names.cc
|
common-opts.cc names.cc
|
||||||
|
|
||||||
$(here)parser-tab.cc $(here)parser-tab.hh: $(here)parser.y
|
$(d)/parser-tab.cc $(d)/parser-tab.hh: $(d)/parser.y
|
||||||
bison -v -o $(here)parser-tab.cc $< -d
|
bison -v -o $(libexpr_DIR)/parser-tab.cc $< -d
|
||||||
|
|
||||||
$(here)lexer-tab.cc $(here)lexer-tab.hh: $(here)lexer.l
|
$(d)/lexer-tab.cc $(d)/lexer-tab.hh: $(d)/lexer.l
|
||||||
flex --outfile $(here)lexer-tab.cc --header-file=$(here)lexer-tab.hh $<
|
flex --outfile $(libexpr_DIR)/lexer-tab.cc --header-file=$(libexpr_DIR)/lexer-tab.hh $<
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LIBS += libmain
|
LIBS += libmain
|
||||||
|
|
||||||
libmain_DIR := $(here)
|
libmain_DIR := $(d)
|
||||||
|
|
||||||
libmain_SOURCES = shared.cc stack.cc
|
libmain_SOURCES = shared.cc stack.cc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LIBS += libstore
|
LIBS += libstore
|
||||||
|
|
||||||
libstore_DIR := $(here)
|
libstore_DIR := $(d)
|
||||||
|
|
||||||
libstore_SOURCES = \
|
libstore_SOURCES = \
|
||||||
store-api.cc local-store.cc remote-store.cc derivations.cc build.cc misc.cc \
|
store-api.cc local-store.cc remote-store.cc derivations.cc build.cc misc.cc \
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
LIBS += libutil
|
LIBS += libutil
|
||||||
|
|
||||||
libutil_DIR := $(here)
|
libutil_DIR := $(d)
|
||||||
|
|
||||||
libutil_SOURCES = util.cc hash.cc serialise.cc archive.cc xml-writer.cc affinity.cc \
|
libutil_SOURCES = util.cc hash.cc serialise.cc archive.cc xml-writer.cc affinity.cc
|
||||||
md5.c sha1.c sha256.c
|
|
||||||
|
|
||||||
# FIXME: md5.c et al. should only be built when we don't have OpenSSL.
|
ifneq ($(HAVE_OPENSSL), 1)
|
||||||
|
libutil_SOURCES += md5.c sha1.c sha256.c
|
||||||
|
endif
|
||||||
|
|
||||||
libutil_LIBS = src/boost/format/libformat
|
libutil_LIBS = src/boost/format/libformat
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PROGRAMS += nix-daemon
|
PROGRAMS += nix-daemon
|
||||||
|
|
||||||
nix-daemon_DIR := $(here)
|
nix-daemon_DIR := $(d)
|
||||||
|
|
||||||
nix-daemon_SOURCES = nix-daemon.cc
|
nix-daemon_SOURCES = nix-daemon.cc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PROGRAMS += nix-env
|
PROGRAMS += nix-env
|
||||||
|
|
||||||
nix-env_DIR := $(here)
|
nix-env_DIR := $(d)
|
||||||
|
|
||||||
nix-env_SOURCES = nix-env.cc profiles.cc profiles.hh user-env.cc user-env.hh
|
nix-env_SOURCES = nix-env.cc profiles.cc profiles.hh user-env.cc user-env.hh
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PROGRAMS += nix-hash
|
PROGRAMS += nix-hash
|
||||||
|
|
||||||
nix-hash_DIR := $(here)
|
nix-hash_DIR := $(d)
|
||||||
|
|
||||||
nix-hash_SOURCES = nix-hash.cc
|
nix-hash_SOURCES = nix-hash.cc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PROGRAMS += nix-instantiate
|
PROGRAMS += nix-instantiate
|
||||||
|
|
||||||
nix-instantiate_DIR := $(here)
|
nix-instantiate_DIR := $(d)
|
||||||
|
|
||||||
nix-instantiate_SOURCES = nix-instantiate.cc
|
nix-instantiate_SOURCES = nix-instantiate.cc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PROGRAMS += nix-store
|
PROGRAMS += nix-store
|
||||||
|
|
||||||
nix-store_DIR := $(here)
|
nix-store_DIR := $(d)
|
||||||
|
|
||||||
nix-store_SOURCES = nix-store.cc dotgraph.cc xmlgraph.cc
|
nix-store_SOURCES = nix-store.cc dotgraph.cc xmlgraph.cc
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue