public
Description: A small OS for high reliability low memory embeded applications
Clone URL: git://github.com/andrewguy9/kernelpanic.git
Total overhaul of makefiles complete.
Now we have a standardized set of variables which define
a build. Those vars are expressed in a prefix at the front
of generated files to differentiate them from those of other
builds.
Andrew Thomson (author)
Tue Jul 29 18:50:52 -0700 2008
commit  3acaec237e0ecad59436c22de324d8ea4296cf5d
tree    7be9e7c259615dcfda2183650308db2ba6f3d55f
parent  9aa34b165a8df81b27f73905f606a0f7f4c34c42
...
1
2
 
3
 
4
5
6
...
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
 
 
 
50
51
 
 
52
53
 
54
55
 
56
57
58
 
59
60
61
62
63
64
65
66
67
68
...
74
75
76
77
78
79
80
81
82
83
84
 
...
1
 
2
3
4
5
6
7
...
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
50
51
52
53
54
 
55
56
57
58
 
 
 
59
60
 
61
62
63
64
 
65
66
67
68
69
70
 
71
72
73
 
74
75
76
77
78
79
80
 
81
82
83
...
89
90
91
 
92
93
 
94
95
 
 
96
0
@@ -1,6 +1,7 @@
0
 ##############################################
0
-# Build strings (Prefix)
0
+# Build strings (Object file prefix)
0
 ##############################################
0
+#prefix is defined as arch_debug_target
0
 #arch
0
 PC_PREFIX = pc_
0
 AVR_PREFIX = avr_
0
@@ -10,59 +11,73 @@ FRE_PREFIX = fre_
0
 #target
0
 APP_PREFIX = app_
0
 KERN_PREFIX = kern_
0
+
0
+
0
+##############################################
0
+#Compiler Parameters
0
 ##############################################
0
-#C flags
0
-PC_CFLAGS = -p -g -Wall
0
+#c flags
0
+PC_CFLAGS = "-p -g -Wall"
0
 ifeq ($(shell uname), Darwin)
0
-AVR_CFLAGS = -Wall -mmcu=atmega128 -O2
0
+AVR_CFLAGS = "-Wall -mmcu=atmega128 -O2"
0
 else
0
-AVR_CFLAGS = -Wall -mmcu=atmega128 -gdwarf-2
0
+AVR_CFLAGS = "-Wall -mmcu=atmega128 -gdwarf-2"
0
 endif
0
 ##############################################
0
 # cc
0
 PC_CC = gcc
0
 AVR_CC = avr-gcc
0
+
0
+
0
 ##############################################
0
-# macros
0
+# Macros
0
 ##############################################
0
-#Archetecture
0
-ARCH_AVR = AVR
0
-ARCH_PC = PC
0
+#Architecture
0
+#ARCH_MACRO
0
+ARCH_AVR = AVR_BUILD
0
+ARCH_PC = PC_BUILD
0
 #############################################
0
 #Debug
0
-DEBUG_FRE = FRE
0
-DEBUG_DBG = DBG
0
+#DEBUG_MACRO
0
+DEBUG_FRE = NO_DEBUG
0
+DEBUG_DBG = DEBUG
0
 #############################################
0
 #Build
0
-BUILD_APP = APP
0
-BUILD_KERNEL = KERNEL
0
+#BUILD_MACRO
0
+BUILD_APP = TEST_BUILD
0
+BUILD_KERNEL = KERNEL_BUILD
0
+
0
+
0
 #############################################
0
 #combined strings
0
 #############################################
0
 #target for pc tests (non kernel build)
0
-TEST_STRING = -e TARGET="$(PC_PREFIX)$(DBG_PREFIX)$(APP_PREFIX)" -e CC=$(PC_CC) -e CFLAGS="$(PC_CFLAGS)" -e ARCH=$(ARCH_PC) -e DEBUG=$(DEBUG_DBG) -e BUILD=$(BUILD_APP)
0
+#string carries parameters to lower makefile.
0
+#string_name = TARGET CFLAGS CC ARCH_MACRO DEBUG_MACRO BUILD_MACRO
0
+TEST_STRING = -e TARGET="$(PC_PREFIX)$(DBG_PREFIX)$(APP_PREFIX)" -e CFLAGS=$(PC_CFLAGS) -e CC=$(PC_CC) -e ARCH_MACRO=$(ARCH_PC) -e DEBUG_MACRO=$(DEBUG_DBG) -e BUILD_MACRO=$(BUILD_APP)
0
 #target for pc kernel builds with debug enabled.
0
-PC_STRING = -e TARGET="$(PC_PREFIX)$(DBG_PREFIX)$(KERN_PREFIX)" -e CC=$(PC_CC) -e CFLAGS="$(PC_CFLAGS)" -e ARCH=$(ARCH_PC) -e DEBUG=$(DEBUG_DBG) -e BUILD=$(BUILD_KERNEL)
0
-#target for avr kenrel builds with debug enabled.
0
-AVR_STRING = -e TARGET="$(AVR_PREFIX)$(DBG_PREFIX)$(KERN_PREFIX)" -e CC=$(AVR_CC) -e CFLAGS="$(AVR_CFLAGS)" -e ARCH=$(ARCH_AVR) -e DEBUG=$(DEBUG_DBG) -e BUILD=$(BUILD_KERNEL)
0
+PC_STRING = -e TARGET="$(PC_PREFIX)$(DBG_PREFIX)$(KERN_PREFIX)" -e CFLAGS=$(PC_CFLAGS) -e CC=$(PC_CC) -e ARCH_MACRO=$(ARCH_PC) -e DEBUG_MACRO=$(DEBUG_DBG) -e BUILD_MACRO=$(BUILD_KERNEL)
0
 #target for pc kernel without debug
0
-PC_FRE_STRING = -e TARGET="$(PC_PREFIX)$(FRE_PREFIX)$(KERN_PREFIX)" -e CC=$(PC_CC) -e CFLAGS="$(PC_CFLAGS)" -e ARCH=$(ARCH_PC) -e DEBUG=$(DEBUG_FRE) -e BUILD=$(BUILD_KERNEL)
0
+PC_FRE_STRING = -e TARGET="$(PC_PREFIX)$(FRE_PREFIX)$(KERN_PREFIX)" -e CFLAGS=$(PC_CFLAGS) -e CC=$(PC_CC) -e ARCH_MACRO=$(ARCH_PC) -e DEBUG_MACRO=$(DEBUG_FRE) -e BUILD_MACRO=$(BUILD_KERNEL)
0
+#target for avr kernel builds with debug enabled.
0
+AVR_STRING = -e TARGET="$(AVR_PREFIX)$(DBG_PREFIX)$(KERN_PREFIX)" -e CFLAGS=$(AVR_CFLAGS) -e CC=$(AVR_CC) -e ARCH_MACRO=$(ARCH_AVR) -e DEBUG_MACRO=$(DEBUG_DBG) -e BUILD_MACRO=$(BUILD_KERNEL)
0
 #target for avr kernel without debug
0
-AVR_FRE_STRING = -e TARGET="$(AVR_PREFIX)$(FRE_PREFIX)$(KERN_PREFIX)" -e CC=$(AVR_CC) -e CFLAGS="$(AVR_CFLAGS)" -e ARCH=$(ARCH_AVR) -e DEBUG=$(DEBUG_FRE) -e BUILD=$(BUILD_KERNEL)
0
+AVR_FRE_STRING = -e TARGET="$(AVR_PREFIX)$(FRE_PREFIX)$(KERN_PREFIX)" -e CFLAGS=$(AVR_CFLAGS) -e CC=$(AVR_CC) -e ARCH_MACRO=$(ARCH_AVR) -e DEBUG_MACRO=$(DEBUG_FRE) -e BUILD_MACRO=$(BUILD_KERNEL)
0
+
0
 #############################################
0
 #build rules
0
+#############################################
0
 %.o:
0
- $(CC) $(CFLAGS) -D $(BUILD) -o $@ -c $<
0
+ $(CC) $(CFLAGS) -D $(ARCH_MACRO) -D $(DEBUG_MACRO) -D $(BUILD_MACRO) -o $@ -c $<
0
 
0
 %.out:
0
- $(CC) $(CFLAGS) -D $(BUILD) -o $@ $^
0
+ $(CC) $(CFLAGS) -D $(ARCH_MACRO) -D $(DEBUG_MACRO) -D $(BUILD_MACRO) -o $@ $^
0
 
0
 %.hex: %.out
0
   avr-objcopy -j .text -j .data -O ihex $< $@
0
 
0
 %.elf: %.out
0
   cp $< $@
0
-
0
 #########################################
0
 #clean dir
0
 .phony cleandir:
0
@@ -74,11 +89,8 @@ AVR_FRE_STRING = -e TARGET="$(AVR_PREFIX)$(FRE_PREFIX)$(KERN_PREFIX)" -e CC=$(AV
0
   rm -f $(DIR)/*.hex
0
   rm -f $(DIR)/*.elf
0
   rm -f $(DIR)/*.aws
0
-
0
 ###########################
0
 # tags
0
-#
0
 ctags:
0
   ctags --fields=+S -R .
0
-
0
-#########################
0
+#########################################
...
1
 
2
3
 
4
5
 
6
7
8
9
10
11
12
 
13
14
15
16
17
18
19
20
21
22
...
 
1
2
 
3
4
 
5
6
7
8
9
10
11
 
12
13
14
15
16
 
 
 
17
18
19
0
@@ -1,22 +1,19 @@
0
-all: tests avr pc pc_fre board
0
+.PHONY: all tests avr avr_fre pc pc_fre clean
0
 
0
-include build_rules.mk
0
+all: tests avr avr_fre pc pc_fre
0
 
0
-.PHONY: all tests umouse board motortest clean
0
+include build_rules.mk
0
 
0
 tests:
0
   make $(TEST_STRING) -f makefile.main tests
0
 avr:
0
   make $(AVR_STRING) -f makefile.main umouse
0
 avr_fre:
0
- make $(AVR_STRING) -f makefile.main umouse
0
+ make $(AVR_FRE_STRING) -f makefile.main umouse
0
 pc:
0
   make $(PC_STRING) -f makefile.main umouse
0
 pc_fre:
0
   make $(PC_FRE_STRING) -f makefile.main umouse
0
-board:
0
- make $(AVR_FRE_STRING) -f makefile.main umouse.hex
0
- avrdude -p m128 -U f:w:umouse.hex
0
 
0
 clean:
0
   make -e DIR=. cleandir
...
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
...
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
0
@@ -10,28 +10,28 @@ include test/rules.mk
0
 
0
 #########################
0
 
0
-tests: utils/linktest.out utils/ringtest.out utils/flagtest.out umouse/maptest.out utils/bhamtest.out umouse/motortest.out umouse/floodfilltest.out umouse/movetest.out
0
+tests: utils/$(TARGET)_linktest.out utils/$(TARGET)_ringtest.out utils/$(TARGET)_flagtest.out umouse/$(TARGET)_maptest.out utils/$(TARGET)_bhamtest.out umouse/$(TARGET)_motortest.out umouse/$(TARGET)_floodfilltest.out umouse/$(TARGET)_movetest.out
0
 
0
 umouse: $(TARGET)_test0.elf $(TARGET)_test1.elf $(TARGET)_test2.elf $(TARGET)_test3.elf $(TARGET)_test4.elf $(TARGET)_test5.elf $(TARGET)_test6.elf $(TARGET)_test7.elf $(TARGET)_umouse.elf
0
 
0
 #########################
0
 #utils on board tests
0
 
0
-utils/linktest.out: utils/$(TARGET)_linktest.o utils/$(TARGET)_linkedlist.o utils/$(TARGET)_heap.o
0
+utils/$(TARGET)_linktest.out: utils/$(TARGET)_linktest.o utils/$(TARGET)_linkedlist.o utils/$(TARGET)_heap.o
0
 
0
-utils/ringtest.out: utils/$(TARGET)_ringtest.o utils/$(TARGET)_ringbuffer.o
0
+utils/$(TARGET)_ringtest.out: utils/$(TARGET)_ringtest.o utils/$(TARGET)_ringbuffer.o
0
 
0
-utils/flagtest.out: utils/$(TARGET)_flagtest.o utils/$(TARGET)_flags.o
0
+utils/$(TARGET)_flagtest.out: utils/$(TARGET)_flagtest.o utils/$(TARGET)_flags.o
0
 
0
-utils/bhamtest.out: utils/$(TARGET)_bhamtest.o utils/$(TARGET)_bham.o
0
+utils/$(TARGET)_bhamtest.out: utils/$(TARGET)_bhamtest.o utils/$(TARGET)_bham.o
0
 
0
-umouse/maptest.out: umouse/$(TARGET)_maptest.o umouse/$(TARGET)_map.o
0
+umouse/$(TARGET)_maptest.out: umouse/$(TARGET)_maptest.o umouse/$(TARGET)_map.o
0
 
0
-umouse/motortest.out: umouse/$(TARGET)_motor.o umouse/motortest.o
0
+umouse/$(TARGET)_motortest.out: umouse/$(TARGET)_motor.o umouse/$(TARGET)_motortest.o
0
 
0
-umouse/floodfilltest.out: umouse/$(TARGET)_floodfilltest.o umouse/$(TARGET)_floodfill.o utils/$(TARGET)_flags.o umouse/$(TARGET)_map.o
0
+umouse/$(TARGET)_floodfilltest.out: umouse/$(TARGET)_floodfilltest.o umouse/$(TARGET)_floodfill.o utils/$(TARGET)_flags.o umouse/$(TARGET)_map.o
0
 
0
-umouse/movetest.out: umouse/$(TARGET)_movetest.o umouse/$(TARGET)_map.o utils/$(TARGET)_flags.o umouse/$(TARGET)_floodfill.o umouse/$(TARGET)_positionlog.o umouse/$(TARGET)_submove.o
0
+umouse/$(TARGET)_movetest.out: umouse/$(TARGET)_movetest.o umouse/$(TARGET)_map.o utils/$(TARGET)_flags.o umouse/$(TARGET)_floodfill.o umouse/$(TARGET)_positionlog.o umouse/$(TARGET)_submove.o
0
 ############################
0
 $(TARGET)_test0.elf: $(TARGET)_test0.out
0
 
...
1
2
3
4
 
5
6
7
8
 
9
10
11
12
 
13
14
15
...
18
19
20
21
 
22
23
24
...
1
2
3
 
4
5
6
7
 
8
9
10
11
 
12
13
14
15
...
18
19
20
 
21
22
23
24
0
@@ -1,15 +1,15 @@
0
 #map units
0
 umouse/$(TARGET)_map.o: umouse/map.c umouse/map.h
0
 
0
-umouse/maptest.o: umouse/maptest.c
0
+umouse/$(TARGET)_maptest.o: umouse/maptest.c
0
 
0
 umouse/$(TARGET)_floodfill.o: umouse/floodfill.c umouse/floodfill.h
0
 
0
-umouse/floodfilltest.o: umouse/floodfilltest.c
0
+umouse/$(TARGET)_floodfilltest.o: umouse/floodfilltest.c
0
 
0
 umouse/$(TARGET)_move.o: umouse/move.c umouse/move.h
0
 
0
-umouse/movetest.o: umouse/movetest.c
0
+umouse/$(TARGET)_movetest.o: umouse/movetest.c
0
 
0
 umouse/$(TARGET)_positionlog.o: umouse/positionlog.c umouse/positionlog.h
0
 
0
@@ -18,7 +18,7 @@ umouse/$(TARGET)_submove.o: umouse/submove.c umouse/submove.h
0
 #motor control
0
 umouse/$(TARGET)_motor.o: umouse/motor.c umouse/motor.h
0
 
0
-umouse/motortest.o: umouse/motortest.c
0
+umouse/$(TARGET)_motortest.o: umouse/motortest.c
0
 
0
 #actual umouse exe
0
 umouse/$(TARGET)_main.o: umouse/main.c

Comments

    No one has commented yet.