error: fix compilation
[aversive.git] / Makefile
1 # Microb Technology, Eirbot, Droids-corp 2005 - Zer0
2 # Makefile for generating all tests !
3 #
4
5 PROJECT_DIRS=\
6 modules/base/math/fixed_point/test\
7 modules/base/math/vect2/test\
8 modules/base/scheduler/test\
9 modules/crypto/test\
10 modules/encoding/hamming/test\
11 modules/encoding/base64/test\
12 modules/comm/uart/test\
13 modules/debug/diagnostic/test\
14 modules/ihm/menu/test\
15 modules/hardware/adc/test\
16 modules/hardware/timer/test\
17 modules/hardware/pwm/test\
18 modules/devices/ihm/lcd/test\
19 modules/devices/servo/multiservo/test\
20 modules/devices/robot/robot_system/test\
21 modules/devices/control_system/control_system_manager/test\
22 modules/devices/control_system/filters/pid/test\
23 modules/devices/control_system/filters/quadramp/test\
24 modules/debug/error/test\
25 projects/example1\
26 projects/example2
27
28 HOSTPROJECT_DIRS=\
29 modules/base/math/fixed_point/test\
30 modules/base/math/vect2/test\
31 modules/crypto/test\
32 modules/encoding/hamming/test\
33 modules/encoding/base64/test\
34 modules/ihm/menu/test\
35 modules/devices/control_system/control_system_manager/test\
36 modules/devices/control_system/filters/pid/test\
37 modules/devices/control_system/filters/quadramp/test
38
39 CFLAGS=-Werror
40 export CFLAGS
41
42
43 all: avrall hostall
44
45
46 clean: avrclean hostclean
47
48
49 %_config:
50         @if [ \( ! -f $(@:_config=)/.aversive_conf \) -o \
51               \( ! -f $(@:_config=)/autoconf.h \) ]; then \
52                 echo -n Configuring $(@:_config=)... ; \
53                 make -C $(@:_config=) noconfig > /dev/null; \
54                 echo done ; \
55         fi
56
57 ### AVR
58
59 avrall: $(PROJECT_DIRS:=_config) $(PROJECT_DIRS:=_avrmake)
60
61
62 avrclean: $(PROJECT_DIRS:=_avrclean)
63
64
65 %_avrmake:
66         @echo
67         @echo "Module $(@:_avrmake=) (avr)" | sed 's,.,=,g'
68         @echo "Module $(@:_avrmake=) (avr)"
69         @echo "Module $(@:_avrmake=) (avr)" | sed 's,.,=,g'
70         @echo
71         make -C $(@:_avrmake=)
72
73
74 %_avrclean:
75         make -C $(@:_avrclean=) clean
76
77
78 ### HOST
79
80 hostall: $(HOSTPROJECT_DIRS:=_config) $(HOSTPROJECT_DIRS:=_hostmake)
81
82
83 hostclean: $(HOSTPROJECT_DIRS:=_hostclean)
84
85
86 %_hostmake:
87         @echo
88         @echo "Module $(@:_hostmake=) (host)" | sed 's,.,=,g'
89         @echo "Module $(@:_hostmake=) (host)"
90         @echo "Module $(@:_hostmake=) (host)" | sed 's,.,=,g'
91         @echo
92         make -C $(@:_hostmake=) H=1
93
94
95 %_hostclean:
96         make -C $(@:_hostclean=) clean H=1
97
98
99 ###
100
101 mrproper:
102         find .  -name "autoconf.h" -o -name ".aversive_conf" -o -name "*.hex" -o -name "*~" -o -name "*.eep" -o -name "*.obj" -o -name "*.elf" -o -name "*.map" -o -name "*.obj" -o -name "*.a90" -o -name "*.sym" -o -name "*.lnk" -o -name "*.lss" -o -name "*.a" -o -name "*.{avr,host}.d" -o -name "*.o" -o -name "*.avr.d.*" -o -name "*.host.d.*" -o -name "*.lst" | xargs rm -f
103
104
105 .PHONY : all clean avrall avrclean hostall hostclean \
106  $(PROJECT_DIRS:=.avrall) $(PROJECT_DIRS:=.avrclean) \
107 $(HOSTPROJECT_DIRS:=.hostall) $(HOSTPROJECT_DIRS:=.hostclean)