| 1 | ### -*-makefile-gmake-*- |
| 2 | ### |
| 3 | ### Build OpenSCAD models |
| 4 | ### |
| 5 | ### (c) 2022 Mark Wooding |
| 6 | ### |
| 7 | |
| 8 | ###----- Licensing notice --------------------------------------------------- |
| 9 | ### |
| 10 | ### This program is free software: you can redistribute it and/or modify |
| 11 | ### it under the terms of the GNU General Public License as published by |
| 12 | ### the Free Software Foundation; either version 3 of the License, or (at |
| 13 | ### your option) any later version. |
| 14 | ### |
| 15 | ### This program is distributed in the hope that it will be useful, but |
| 16 | ### WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | ### General Public License for more details. |
| 19 | ### |
| 20 | ### You should have received a copy of the GNU General Public License |
| 21 | ### along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 22 | |
| 23 | all: |
| 24 | |
| 25 | ## `Silent-rules' machinery. |
| 26 | V = 0 |
| 27 | V_AT = $(V_AT).$V |
| 28 | V_AT.0 = @ |
| 29 | v-tag = $(call v-tag.$V,$1) |
| 30 | v-tag.0 = @printf " %-8s %s\n" "$1" "$@"; |
| 31 | |
| 32 | ## Other configuration. |
| 33 | OPENSCAD = openscad |
| 34 | |
| 35 | ## Main list of models. |
| 36 | MODELS += discpick-collar.scad |
| 37 | MODELS += discpick-tensioner.scad |
| 38 | |
| 39 | ## Building models. |
| 40 | CLEANFILES += *.stl |
| 41 | %.stl: %.scad |
| 42 | $(call v-tag,SCAD)$(OPENSCAD) -o$@ -d$*.dep $< |
| 43 | STLS = $(MODELS:.scad=.stl) |
| 44 | all: $(STLS) |
| 45 | |
| 46 | ## Dependency file management. |
| 47 | CLEANFILES += *.dep |
| 48 | DEPS += $(MODELS:.scad=.dep) |
| 49 | -include $(DEPS) |
| 50 | |
| 51 | ## Cleaning up. |
| 52 | clean:; rm -f $(CLEANFILES) |
| 53 | |
| 54 | ###----- That's all, folks -------------------------------------------------- |