-
Notifications
You must be signed in to change notification settings - Fork 3
/
rules.mk
46 lines (34 loc) · 1.22 KB
/
rules.mk
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
##############################################################################
# rules for buildung AVR objects
OBJECTS += $(patsubst %.c,obj_avr/%.o,${SRC})
OBJECTS += $(patsubst %.S,obj_avr/%.o,${ASRC})
./obj_avr/%.o: %.S
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
@ echo "assembling $<"
@ $(CC) -o $@ $(CPPFLAGS) $(ASFLAGS) -c $<
./obj_avr/%.o: %.c
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
@ echo "compiling $<"
@ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
objects_avr: $(OBJECTS)
@ if [ -d obj_avr ]; then echo "writing object inventory" ; echo $(OBJECTS) > obj_avr/.objects ; fi
##############################################################################
# rules for buildung simulator objects
SRC_SIM ?= $(SRC)
OBJECTS_SIM += $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
./obj_sim/%.o: %.c
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
@ echo "compiling $<"
@ $(HOSTCC) -o $@ $(CFLAGS_SIM) -c $<
objects_sim: $(OBJECTS_SIM)
@ echo "writing object ineventory"
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
@ echo $(OBJECTS_SIM) > obj_sim/.objects
clean-common:
$(RM) $(TARGET) *.[odasE] *.d.new *~
$(RM) -r obj_avr
$(RM) -r obj_sim
clean: clean-common
all:
$(MAKE) -C $(TOPDIR) all
#include depend.mk