-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
39 lines (24 loc) · 1 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
VERSION = 0.1
# CUSTOMIZATION
# Arduino APIs compilable under Linux
ArduinoSimDir :=
# Your sketchbook folder + /libraries
ArduinoUserLibDir :=
Hfiles := $(wildcard *.h) $(wildcard $(ArduinoSimDir)/avr/*.h) $(wildcard $(ArduinoSimDir)/*.h) $(wildcard $(ArduinoSimDir)/*/*.h)
Cfiles := $(wildcard *.cpp) $(wildcard *.c) $(wildcard *.pde)
Ofiles := $(patsubst %.pde,%.o,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(Cfiles))))
PdeFile := $(wildcard *.pde)
SimBin := $(patsubst %.pde,%,$(PdeFile))
ArduinoLibDir := $(ArduinoSimDir)/libraries
ArduinoLibsInc := $(addprefix -I,$(wildcard $(ArduinoLibDir)/*))
CF := -c -DSIM -DSIM__AVR_ATmega328P__ -g -O0 -I. -I$(ArduinoUserLibDir)/lightuino5 -I$(ArduinoSimDir) $(ArduinoLibsInc)
LF := -lrt
default: $(SimBin)
%: %.pde $(Ofiles) $(ArduinoSimDir)/libArduinoSim.a
g++ $(LF) -o $@ $(Ofiles) $(ArduinoSimDir)/libArduinoSim.a
%.o: %.cpp $(Hfiles)
g++ $(CF) -o $@ $<
%.o: %.c $(Hfiles)
g++ $(CF) -o $@ $<
%.o: %.pde $(Hfiles)
g++ $(CF) -x c++ -o $@ $<