PREFIX=/usr SHAREDIR=$(PREFIX)/share/models all: \ build/elegoo_saturn_4_tenacious_flex/pinephone/battery_mesh/case.goo \ build/elegoo_saturn_4_tenacious_flex/pinephone/battery_mesh_3_column/case.goo \ build/elegoo_saturn_4_tenacious_flex/pinephone/battery_mesh_5_column/case.goo \ build/elegoo_saturn_4_tenacious_flex/pinephone/battery_mesh_7_column/case.goo \ build/elegoo_saturn_4_tenacious_flex/pinephone/battery_mesh_7_column/case.png \ build/elegoo_saturn_4_phrozen_el400/pinephone/battery_mesh_5_column/case.goo \ build/elegoo_saturn_4_phrozen_el400/pinephone/battery_mesh_7_column/case.goo \ build/generic/pinephone/battery_mesh/case.png \ build/generic/pinephone/battery_mesh/case.stl \ build/generic/pinephone/battery_mesh/case_with_phone.png \ build/generic/pinephone/battery_mesh_3_column/case.png \ build/generic/pinephone/battery_mesh_3_column/case.stl \ build/generic/pinephone/battery_mesh_5_column/case.png \ build/generic/pinephone/battery_mesh_5_column/case.stl \ build/generic/pinephone/battery_mesh_7_column/case.png \ build/generic/pinephone/battery_mesh_7_column/case.stl \ build/jlc_stretch1/pinephone/battery_mesh/case.stl \ build/jlc_stretch2/pinephone/battery_mesh/case.stl \ build/tpu_bambu_p1p/pinephone/battery_mesh/case.gcode \ build/web-viewer/index.html install: mkdir -p $(SHAREDIR) install -m644 build/case.stl $(SHAREDIR) install -m644 build/case.gcode $(SHAREDIR) %/case.vtk %/case.vtk.js: %/config main.py src/*.py mkdir -p "$(@D)" bash -c 'source $*/config; ./main.py --export-vtk $*/case.vtk' %/phone.vtk %/phone.vtk.js: %/config main.py src/*.py mkdir -p "$(@D)" bash -c 'source $*/config; ./main.py --render-phone-only --export-vtk $*/phone.vtk' build/web-viewer/vtk.js: doc.in/vtk.js mkdir -p "$(@D)" cp $< $@ build/web-viewer/renderWindow.js: doc.in/renderWindow.js mkdir -p "$(@D)" cp $< $@ build/web-viewer/index.html: doc.in/index.html build/web-viewer/vtk.js build/web-viewer/renderWindow.js build/generic/pinephone/battery_mesh/case.vtk.js build/generic/pinephone/battery_mesh/phone.vtk.js mkdir -p "$(@D)" cp build/generic/pinephone/battery_mesh/case.vtk.js "$(@D)"/pinephone_case.vtk.js cp build/generic/pinephone/battery_mesh/phone.vtk.js "$(@D)"/pinephone_phone.vtk.js cp doc.in/index.html $@ %/case.png: %/config main.py src/*.py mkdir -p "$(@D)" bash -c 'source $*/config; ./main.py --export-png $@' %/case_with_phone.png: %/config main.py src/*.py mkdir -p "$(@D)" bash -c 'source $*/config; ./main.py --render-phone --export-png $@' %/case.stl: %/config main.py src/*.py mkdir -p "$(@D)" bash -c 'source $*/config; ./main.py --export-stl $@' # e.g. build/tpu_bambu_p1p/pinephone/battery_mesh_3_column/config # TODO: the dependencies here are overly broad build/%/config: profile/model/*.env profile/print/*.env mkdir -p "$(@D)" # e.g. `cat profile/model/pinephone.env profile/variant/battery_mesh_3_column.env profile/print/tpu_bambu_p1p.env` cat profile/model/$(shell basename $(shell dirname $*)).env \ profile/variant/$(shell basename $*).env \ profile/print/$(shell basename $(shell dirname $(shell dirname $*))).env > $@ # .gcode: for FDM printers %/case.gcode: %/config %/case.stl mkdir -p $(shell dirname $@) bash -c 'source $*/config; slic3r $${SLIC3R_FLAGS[@]} $*/case.stl -o $@' # .sl1: for prusa resin-based printers %/case.sl1: %/config %/case.stl bash -c 'source $*/config; prusa-slicer --export-sla $*/case.stl' # .ctb: for Gen 3 Elegoo printers (requires `uvtools` package) %/case.ctb: %/config %/case.sl1 # XXX: UVtoolsCmd exits `1` on success ?? (what does it exit on failure? bleh) bash -c 'source $*/config; UVtoolsCmd convert $< Chitubox $@ || test -f $@/ # .goo: for Gen 4+ Elegoo printers (requires `mslicer` package) %/case.goo: %/config %/case.stl bash -c 'source $*/config; slicer --mesh $*/case.stl $${MSLICER_FLAGS[@]} $@' readme: readme_files/pinephone_front_case_with_phone.png readme_files/pinephone_back_case_with_phone.png readme_files/pinephone_side_case_with_phone.png doc: readme build/web_viewer/index.html clean: rm -rf build/* # upload: build/case.gcode # lftp -e "set ssl:verify-certificate false; put $<; exit" -u ${PRINTER_AUTH} ftps://${PRINTER_HOST} .PHONY: all install readme doc clean upload # instruct Make to not garbage-collect intermediate targets .SECONDARY: