From 4a1b8166e1263eadff3ae0580ba3780dfd0a0e86 Mon Sep 17 00:00:00 2001 From: Michael Schwarz Date: Thu, 10 Sep 2015 23:04:44 +0200 Subject: Only print abstract information about commands being executed. Most commands only show the python wrapper being called, which does not tell the user much anyways. --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 854e2d2..1a786c4 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,9 @@ ASYMPTOTE_EXPORTED_SVG_FILES := # Remove targets whose command failed. .DELETE_ON_ERROR: -# Goal to build Everything. Also generates files which aren't compiled to anything else. Deined here to make it the default goal. -all: generated dxf stl asy pdf +.SILENT: + +.DEFAULT_GOAL := all # Include the configuration files. -include config.mk settings.mk @@ -31,11 +32,13 @@ ASYMPTOTE_CMD := ASYMPTOTE=$(ASYMPTOTE) $(PYTHON_CMD) -m asymptote # Takes a list of file names and returns all elements whose basename do not start with a `_' and which have extension ext. The returned names will have their extension replaced by subst_ext. filter_compiled = $(foreach i,$(patsubst %$1,%$2,$(filter %$1,$3)),$(if $(filter-out _%,$(notdir $i)),$i)) +EXISTING_FILES := $(shell find src -not \( \( -name '.*' -or -name '* *' \) -prune \) -type f) + # Run generate_scad.sh to get the names of all files that should be generated using that same script. GENERATED_FILES := $(shell ./generate_sources.sh) # All visible files in the src directory that either exist or can be generated. Ignore files whose names contain spaces. -SRC_FILES := $(sort $(GENERATED_FILES) $(shell find src -not \( \( -name '.*' -or -name '* *' \) -prune \) -type f)) +SRC_FILES := $(sort $(GENERATED_FILES) $(EXISTING_FILES)) # STL files produced from OpenSCAD files. SCAD_STL_FILES := $(call filter_compiled,.scad,.stl,$(filter-out $(FLAT_SCAD_FILES),$(SRC_FILES))) @@ -64,9 +67,15 @@ ASY_DEPS := $(filter %.asy,$(SRC_FILES)) $(SVG_ASY_FILES) # Dependencies which may affect the result of all build products. GLOBAL_DEPS := Makefile $(wildcard config.mk settings.mk) +EXISTING_TARGETS := $(filter $(SVG_DXF_FILES) $(SCAD_DXF_FILES) $(SCAD_STL_FILES) $(SVG_ASY_FILES) $(ASY_PDF_FILES) $(GENERATED_FILES) $(DEPENDENCY_FILES),$(EXISTING_FILES)) + # Everything^-1. clean: - rm -rf $(SVG_DXF_FILES) $(SCAD_DXF_FILES) $(SCAD_STL_FILES) $(SVG_ASY_FILES) $(ASY_PDF_FILES) $(GENERATED_FILES) $(DEPENDENCY_FILES) + echo [clean] $(EXISTING_TARGETS) + rm -rf $(EXISTING_TARGETS) + +# Goal to build Everything. Also generates files which aren't compiled to anything else. Deined here to make it the default goal. +all: generated dxf stl asy pdf # Goals to build the project up to a specific step. generated: $(GENERATED_FILES) @@ -77,25 +86,31 @@ asy: $(SVG_ASY_FILES) # Rule to convert an SVG file to a DXF file. $(SVG_DXF_FILES): %.dxf: %.svg $(GLOBAL_DEPS) + echo [inkscape] $@ $(INKSCAPE_CMD) $< $@ $(SVG_ASY_FILES): %.asy: %.svg $(GLOBAL_DEPS) + echo [inkscape] $@ $(INKSCAPE_CMD) $< $@ # Rule to compile an OpenSCAD file to a DXF file. $(SCAD_DXF_FILES): %.dxf: %.scad $(GLOBAL_DEPS) | $(SCAD_ORDER_DEPS) + echo [openscad] $@ $(OPENSCAD_CMD) $< $@ $*.d # Rule to compile an OpenSCAD file to an STL file. $(SCAD_STL_FILES): %.stl: %.scad $(GLOBAL_DEPS) | $(SCAD_ORDER_DEPS) + echo [openscad] $@ $(OPENSCAD_CMD) $< $@ $*.d # Rule to export an SVG file to an Asymptote file. $(ASY_PDF_FILES): %.pdf: $(ASY_DEPS) $(GLOBAL_DEPS) + echo [asymptote] $@ $(ASYMPTOTE_CMD) $*.asy $@ # Rule for automaticaly generated OpenSCAD files. $(GENERATED_FILES): generate_sources.sh $(GLOBAL_DEPS) + echo [generate] $@ ./generate_sources.sh $@ # Include dependency files produced by an earlier build. -- cgit