From dc6284662bd4d42280e82833ef6350c3c096ae8b Mon Sep 17 00:00:00 2001 From: Michael Schwarz Date: Mon, 9 Mar 2015 18:29:19 +0100 Subject: Added makefile targets to build the project to a certain step. --- Makefile | 9 ++++++++- readme.creole | 37 ++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 01a0e45..51108ab 100644 --- a/Makefile +++ b/Makefile @@ -36,13 +36,20 @@ DXF_FILES := $(patsubst %.svg,%.dxf,$(SVG_FILES)) # Dependencies which may affect the result of all build products. GLOBAL_DEPS := Makefile $(wildcard config.mk settings.mk) +.PHONY: all clean generated dxf stl + # Everything. Also generates files which aren't compiled to anything else. -all: $(GENERATED_FILES) $(DXF_FILES) $(STL_FILES) +all: generated dxf stl # Everything^-1. clean: rm -rf $(GENERATED_FILES) $(DXF_FILES) $(STL_FILES) $(DEPENDENCY_FILES) +# Targets to build the project up to a specific step. +generated: $(GENERATED_FILES) +dxf: $(DXF_FILES) +stl: $(STL_FILES) + # Include the local configuration file and the dependency files. Needs to be included after the `all' target has been defined. -include config.mk settings.mk $(DEPENDENCY_FILES) diff --git a/readme.creole b/readme.creole index e8a5a5b..84e438a 100644 --- a/readme.creole +++ b/readme.creole @@ -77,16 +77,6 @@ use OpenSCAD files may be compiled to STL and used from other OpenSCAD files at the same time. Please see the [http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Print_version|manual] for details and on how to use OpenSCAD in general. -=== Settings used for compilation - -The quality of the DXF export can be specified by creating a file called `settings.mk` in the same directory as the makefile. Setting `DXF_FLATNESS` to a smaller value (which defaults to `0.1`) creates a shape that more closely follows curved parts of the exported shapes. - -{{{ -# Specify how far the exported approximation may deviate from the actual shape. The default is 0.1. -DXF_FLATNESS := 0.02 -}}} - - == Generating Source files This template includes support automatically generated source files. Currently supported for inclusion in the build process are OpenSCAD and SVG files. This works by editing the `generate_sources.sh` script. @@ -98,7 +88,32 @@ The script defines a function `generate_file()`, which should be called in the r To compile the whole project, run `make` from the directory in which this readme is. This will generate all sources files, if any, process all SVG files and produce an STL file for each OpenSCAD source file whose name does not start with `_`. Individual files may be created or updated by passing their names to the make command, as usual. -To remove all generated files, run `make clean`. + +=== Makefile targets + +These are all makefile targets which are not the path of a single file to build: + +- `all`: This target will build all files that can be built from all source files. This is the default target when just running `make`. + +- `clean`: Removes all built files [1]. + +- `generated`: Generates all files generated by `generate_sources.sh`. + +- `dxf`: Converts all SVG files to DXF files. + +- `stl`: Compiles all OpenSCAD files to STL files. + +[1]: This will not remove files for which the source file was removed. There is no simple way to detect whether a file was previously built from a source file or was placed in the `src` directory manually. + + +=== Settings used for compilation + +The quality of the DXF export can be specified by creating a file called `settings.mk` in the same directory as the makefile. Setting `DXF_FLATNESS` to a smaller value (which defaults to `0.1`) creates a shape that more closely follows curved parts of the exported shapes. + +{{{ +# Specify how far the exported approximation may deviate from the actual shape. The default is 0.1. +DXF_FLATNESS := 0.02 +}}} === Dependency tracking -- cgit