-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (40 loc) · 1.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Applications
EAGLE:=$(shell ls /mnt/c/Program\ Files/EAGLE*/eagle.exe)
OPENSCAD:=/mnt/c/Program Files/OpenSCAD/openscad.exe
# Find all source files
SCHEMATIC_FILES:=$(shell find . -type f -name '*.sch')
BOARD_FILES:=$(shell find . -type f -name '*.brd')
SCAD_FILES:=$(shell find . -type f -name '*.scad')
# Define targets
$(foreach f,$(SCHEMATIC_FILES), \
$(eval tmp:=$(patsubst %.sch, %-schematic.png, $(f))) \
$(eval $(tmp): $(f)) \
$(eval SCHEMATIC_TARGETS+=$(tmp)) \
)
$(foreach f,$(BOARD_FILES), \
$(eval tmp:=$(patsubst %.brd, %-layout.png, $(f))) \
$(eval $(tmp): $(f)) \
$(eval BOARD_TARGETS+=$(tmp)) \
)
$(foreach f,$(SCAD_FILES), \
$(eval tmp:=$(patsubst %.scad, %.stl, $(f))) \
$(eval $(tmp): $(f)) \
$(eval SCAD_TARGETS+=$(tmp)) \
)
# Build rules
%-schematic.png:
@echo "Generating $@"
@rm -f $@
@"$(EAGLE)" -C "EXPORT IMAGE $@ 300; QUIT" $<
%-layout.png:
@echo "Generating $@"
@rm -f $@
@"$(EAGLE)" -C "RATSNEST; EXPORT IMAGE $@ 300; UNDO; QUIT" $<
%.stl:
@echo "Generating $@"
@"$(OPENSCAD)" -o $@ $<
all: $(SCHEMATIC_TARGETS) $(BOARD_TARGETS) $(SCAD_TARGETS)
clean:
rm -f $(SCHEMATIC_TARGETS) $(BOARD_TARGETS) $(SCAD_TARGETS)
.DEFAULT_GOAL:=all
.PHONY:=all clean