takeup/Makefile

56 lines
1.9 KiB
Makefile

###################
#
# takeup module OpenSCAD Makefile
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
###################
PREFIX=takeup
OPENSCAD=openscad
OPENSCAD_OPTIONS=-D VERBOSE=false
OPENSCAD_IMAGE_OPTIONS=--imgsize=1024,1024 --colorscheme=DeepOcean --render
STL=./stl
IMG=./img
MODELS=$(shell bash ./parseVars.sh PART)
all: directories models
directories:
mkdir -p $(STL) $(IMG)
models: directories $(MODELS)
clean:
rm -f $(STL)/$(PREFIX)_*
rm -f $(IMG)/$(PREFIX)_*
cleanall:
rm -rf $(STL)
rm -rf $(IMG)
# Dependencies for models
$(MODELS) : $(STL)/$(PREFIX)_%.stl : $(PREFIX).scad
$(OPENSCAD) $(OPENSCAD_OPTIONS) -o $@ -D PART=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<
$(OPENSCAD) $(OPENSCAD_OPTIONS) $(OPENSCAD_IMAGE_OPTIONS) -o $(IMG)/$(subst $(STL),$(IMG)},$(subst .stl,.png,$(@F))) -D PART=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<