From 98ce3d9f82847932f974b10841ccb77b3cba838f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 11 Oct 2009 18:35:19 +0200 Subject: Add install target --- build/bootstrap.make | 23 ++++++++++++++++++++--- cli/makefile | 5 ----- doc/makefile | 25 +++++++++++++++++++++++++ examples/features/makefile | 9 +++++++++ examples/hello/makefile | 9 +++++++++ examples/makefile | 5 +++-- makefile | 15 +++++++++------ tests/lexer/makefile | 11 ----------- tests/makefile | 2 -- tests/parser/makefile | 12 ------------ 10 files changed, 75 insertions(+), 41 deletions(-) create mode 100644 doc/makefile diff --git a/build/bootstrap.make b/build/bootstrap.make index 684eaa1..204eaf2 100644 --- a/build/bootstrap.make +++ b/build/bootstrap.make @@ -26,11 +26,14 @@ $(call include,$(bld_root)/cxx/configuration.make) # Aliases # +.PHONY: $(out_base)/ \ + $(out_base)/.test \ + $(out_base)/.install \ + $(out_base)/.clean + ifdef %interactive% -.PHONY: test $(out_base)/.test \ - install $(out_base)/.install \ - clean $(out_base)/.clean +.PHONY: test install clean test: $(out_base)/.test install: $(out_base)/.install @@ -64,4 +67,18 @@ ifneq ($(filter $(MAKECMDGOALS),clean disfigure),) include-dep = endif +# For install, don't include dependecies in examples, and tests. +# +ifneq ($(filter $(MAKECMDGOALS),install),) + +ifneq ($(subst $(src_root)/tests/,,$(src_base)),$(src_base)) +include-dep = +endif + +ifneq ($(subst $(src_root)/examples/,,$(src_base)),$(src_base)) +include-dep = +endif + +endif + .DEFAULT_GOAL := $(def_goal) diff --git a/cli/makefile b/cli/makefile index 5a2f771..1bea738 100644 --- a/cli/makefile +++ b/cli/makefile @@ -68,20 +68,15 @@ $(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) # Alias for default target. # -.PHONY: $(out_base)/ $(out_base)/: $(cli) # Install. # -.PHONY: $(install) - $(install): $(cli) $(call install-exec,$<,$(install_bin_dir)/cli) # Clean. # -.PHONY: $(clean) - $(clean): \ $(cli).o.clean \ $(addsuffix .cxx.clean,$(cxx_obj)) \ diff --git a/doc/makefile b/doc/makefile new file mode 100644 index 0000000..6ccfabb --- /dev/null +++ b/doc/makefile @@ -0,0 +1,25 @@ +# file : doc/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009 Code Synthesis Tools CC +# license : MIT; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make + +default := $(out_base)/ +install := $(out_base)/.install +cleandoc := $(out_base)/.cleandoc + +$(default): + +# Install. +# +$(install): + $(call install-data,$(src_base)/default.css,$(install_doc_dir)/cli/default.css) + $(call install-data,$(src_base)/cli.xhtml,$(install_doc_dir)/cli/cli.xhtml) + $(call install-data,$(src_base)/cli.1,$(install_man_dir)/man1/cli.1) + +# Clean. +# +$(cleandoc): + +$(call include,$(bld_root)/install.make) diff --git a/examples/features/makefile b/examples/features/makefile index c599afe..52d5d38 100644 --- a/examples/features/makefile +++ b/examples/features/makefile @@ -12,6 +12,7 @@ obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o)) dep := $(obj:.o=.o.d) driver := $(out_base)/driver +install := $(out_base)/.install clean := $(out_base)/.clean # Build. @@ -32,6 +33,14 @@ $(call include-dep,$(dep),$(obj),$(gen)) # $(out_base)/: $(driver) +# Install +# +$(install): path := $(subst $(src_root)/,,$(src_base)) +$(install): + $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx) + $(call install-data,$(src_base)/options.cli,$(install_doc_dir)/cli/$(path)/options.cli) + $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README) + # Clean. # $(clean): $(driver).o.clean \ diff --git a/examples/hello/makefile b/examples/hello/makefile index f5c191c..49e99b9 100644 --- a/examples/hello/makefile +++ b/examples/hello/makefile @@ -12,6 +12,7 @@ obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o)) dep := $(obj:.o=.o.d) driver := $(out_base)/driver +install := $(out_base)/.install clean := $(out_base)/.clean # Build. @@ -32,6 +33,14 @@ $(call include-dep,$(dep),$(obj),$(gen)) # $(out_base)/: $(driver) +# Install +# +$(install): path := $(subst $(src_root)/,,$(src_base)) +$(install): + $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx) + $(call install-data,$(src_base)/hello.cli,$(install_doc_dir)/cli/$(path)/hello.cli) + $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README) + # Clean. # $(clean): $(driver).o.clean \ diff --git a/examples/makefile b/examples/makefile index 0180e9a..135b9bb 100644 --- a/examples/makefile +++ b/examples/makefile @@ -8,11 +8,12 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make examples := hello features default := $(out_base)/ +install := $(out_base)/.install clean := $(out_base)/.clean -.PHONY: $(default) $(clean) - $(default): $(addprefix $(out_base)/,$(addsuffix /,$(examples))) +$(install): $(addprefix $(out_base)/,$(addsuffix /.install,$(examples))) + $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/examples/README) $(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(examples))) $(foreach e,$(examples),$(call import,$(src_base)/$e/makefile)) diff --git a/makefile b/makefile index c50b41f..7e0c095 100644 --- a/makefile +++ b/makefile @@ -10,12 +10,13 @@ test := $(out_base)/.test install := $(out_base)/.install clean := $(out_base)/.clean - -.PHONY: $(default) $(test) $(install) $(clean) - # Build. # -$(default): $(out_base)/cli/ $(out_base)/tests/ $(out_base)/examples/ +$(default): \ +$(out_base)/cli/ \ +$(out_base)/doc/ \ +$(out_base)/tests/ \ +$(out_base)/examples/ # Test. # @@ -23,8 +24,9 @@ $(test): $(out_base)/tests/.test # Install. # -$(install): $(out_base)/cli/.install \ - $(out_base)/documentation/.install +$(install): $(out_base)/cli/.install \ + $(out_base)/doc/.install \ + $(out_base)/examples/.install $(call install-data,$(src_base)/LICENSE,$(install_doc_dir)/cli/LICENSE) $(call install-data,$(src_base)/NEWS,$(install_doc_dir)/cli/NEWS) $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/README) @@ -38,5 +40,6 @@ $(clean): $(out_base)/cli/.clean \ $(call include,$(bld_root)/install.make) $(call import,$(src_base)/cli/makefile) +$(call import,$(src_base)/doc/makefile) $(call import,$(src_base)/tests/makefile) $(call import,$(src_base)/examples/makefile) diff --git a/tests/lexer/makefile b/tests/lexer/makefile index 7af0e62..5b5df9a 100644 --- a/tests/lexer/makefile +++ b/tests/lexer/makefile @@ -33,38 +33,28 @@ $(cxx_obj) $(cxx_od): $(cutl.l.cpp-options) $(call include-dep,$(cxx_od)) - # Alias for default target. # -.PHONY: $(out_base)/ $(out_base)/: $(driver) - # Test. # test_targets := $(addprefix $(out_base)/.test-,$(tests)) -.PHONY: $(test) $(test): $(test_targets) - - $(test_targets): driver := $(driver) .PHONY: $(out_base)/.test-% $(out_base)/.test-%: $(driver) $(src_base)/test-%.cli $(src_base)/test-%.std $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.cli | diff -u $(src_base)/test-$*.std -) - # Clean. # -.PHONY: $(clean) - $(clean): \ $(driver).o.clean \ $(addsuffix .cxx.clean,$(cxx_obj)) \ $(addsuffix .cxx.clean,$(cxx_od)) - # Generated .gitignore. # ifeq ($(out_base),$(src_base)) @@ -76,7 +66,6 @@ $(clean): $(out_base)/.gitignore.clean $(call include,$(bld_root)/git/gitignore.make) endif - # How to. # $(call include,$(bld_root)/cxx/o-e.make) diff --git a/tests/makefile b/tests/makefile index 7e54132..422b93b 100644 --- a/tests/makefile +++ b/tests/makefile @@ -11,8 +11,6 @@ default := $(out_base)/ test := $(out_base)/.test clean := $(out_base)/.clean -.PHONY: $(default) $(test) $(clean) - $(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests))) $(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests))) $(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests))) diff --git a/tests/parser/makefile b/tests/parser/makefile index a43af9a..c64e496 100644 --- a/tests/parser/makefile +++ b/tests/parser/makefile @@ -18,7 +18,6 @@ driver := $(out_base)/driver test := $(out_base)/.test clean := $(out_base)/.clean - # Build. # # Import. @@ -51,38 +50,28 @@ $(cxx_obj) $(cxx_od): $(cutl.l.cpp-options) $(call include-dep,$(cxx_od)) - # Alias for default target. # -.PHONY: $(out_base)/ $(out_base)/: $(driver) - # Test. # test_targets := $(addprefix $(out_base)/.test-,$(tests)) -.PHONY: $(test) $(test): $(test_targets) - - $(test_targets): driver := $(driver) .PHONY: $(out_base)/.test-% $(out_base)/.test-%: $(driver) $(src_base)/test-%.cli $(src_base)/test-%.std $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.cli | diff -u $(src_base)/test-$*.std -) - # Clean. # -.PHONY: $(clean) - $(clean): \ $(driver).o.clean \ $(addsuffix .cxx.clean,$(cxx_obj)) \ $(addsuffix .cxx.clean,$(cxx_od)) - # Generated .gitignore. # ifeq ($(out_base),$(src_base)) @@ -94,7 +83,6 @@ $(clean): $(out_base)/.gitignore.clean $(call include,$(bld_root)/git/gitignore.make) endif - # How to. # $(call include,$(bld_root)/cxx/o-e.make) -- cgit v1.1