summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMichael Schwarz <michi.schwarz@gmail.com>2015-03-07 11:52:29 +0100
committerMichael Schwarz <michi.schwarz@gmail.com>2015-03-07 12:23:59 +0100
commitb424b1bf755c675416ad716f43185ac8c89a2fb4 (patch)
tree1020fcc169ca2a4db93da05d7263008834590ec7 /Makefile
parentc6ebf8db53106bafdf0233da6e8e85d6479e8df6 (diff)
downloadpogojig-b424b1bf755c675416ad716f43185ac8c89a2fb4.tar.gz
pogojig-b424b1bf755c675416ad716f43185ac8c89a2fb4.tar.bz2
pogojig-b424b1bf755c675416ad716f43185ac8c89a2fb4.zip
makefile: Call find only once.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index f9e4008..867512a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,16 @@
+# Used by dxf_export/main.sh
INKSCAPE ?= inkscape
OPENSCAD ?= openscad
PYTHON ?= python2
PYTHON_CMD := PYTHONPATH="support:$$PYTHONPATH" $(PYTHON)
-# Used by dxf_export/main.sh
export INKSCAPE OPENSCAD
-ifneq ($(shell find src -name '* *'),)
- $(error Error: The src directory contains files with spaces in their names, this is not supported by make)
-endif
+# All visible files in the src directory. Ignore files whose names contain spaces.
+SRC_FILES := $(shell find src -not \( \( -name '.*' -or -name '* *' \) -prune \))
+SRC_SCAD_FILES := $(filter %.scad,$(SRC_FILES))
+SRC_SVG_FILES := $(filter %.svg,$(SRC_FILES))
# Run generate_scad.sh to get the names of all OpenSCAD files that should be generated using that same script.
GENERATED_FILES := $(addsuffix .scad,$(basename $(shell ./generate_sources.sh)))
@@ -17,10 +18,10 @@ GENERATED_SVG_FILES := $(filter %.svg, $(GENERATED_FILES))
GENERATED_SCAD_FILES := $(filter %.scad, $(GENERATED_FILES))
# Source SVG files.
-SVG_FILES := $(shell find src -name '*.svg') $(GENERATED_SVG_FILES)
+SVG_FILES := $(SRC_SVG_FILES) $(GENERATED_SVG_FILES)
# Only OpenSCAD files whose names do not start with `_' are compiled to STL.
-COMPILED_SCAD_FILES := $(foreach i,$(shell find src -name '*.scad') $(GENERATED_SCAD_FILES),$(if $(filter-out _%,$(notdir $(i))),$(i)))
+COMPILED_SCAD_FILES := $(foreach i, $(SRC_SCAD_FILES) $(GENERATED_SCAD_FILES),$(if $(filter-out _%,$(notdir $(i))),$(i)))
# Makefiles which are generated while compiling to record dependencies.
DEPENDENCY_FILES := $(patsubst %.scad,%.d,$(COMPILED_SCAD_FILES))