blob: 636e5537c6cb8669736b58425defd08c495dec59 (
plain)
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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
## This is Architecture independant part of the makefile
uses HAVE_OPTION_TABLE
makedefine CPP:= $(CC) -no-gcc -x assembler-with-cpp -DASSEMBLY -E
makedefine LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name)
makedefine GCC_INC_DIR := $(shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
makedefine CPPFLAGS := -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS)
makedefine ROMCCPPFLAGS := -D__ROMCC__=0 -D__ROMCC_MINOR__=38
makedefine CFLAGS := $(CPU_OPT) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin -Wall
makedefine HOSTCFLAGS:= -Os -Wall
makerule ldscript.ld
depends "ldoptions $(LDSUBSCRIPTS-1)"
action "echo \"INCLUDE ldoptions\" > $@ ; for file in $(LDSUBSCRIPTS-1) ; do echo \"INCLUDE $$file\" >> $@ ; done"
end
#makerule cpuflags
# depends "Makefile.settings"
# action "perl -e 'print \"CPUFLAGS :=\n\"; foreach $$var (split(\" \", $$ENV{VARIABLES})) { if (exists($$ENV{$$var})) { print \"CPUFLAGS += -D$$var\" . (length($$ENV{$$var})?\"=\x27$$ENV{$$var}\x27\":\"\") .\"\n\"} else { print \"CPUFLAGS += -U$$var\n\"} }' > $@"
#end
#makerule ldoptions
# depends "Makefile.settings"
# action "perl -e 'foreach $$var (split(\" \", $$ENV{VARIABLES})) { if ($$ENV{$$var} =~ m/^(0x[0-9a-fA-F]+|0[0-7]+|[0-9]+)$$/) { print \"$$var = $$ENV{$$var};\n\"; }}' > $@"
#end
makerule linuxbios.strip
depends "linuxbios"
action "$(OBJCOPY) -O binary linuxbios linuxbios.strip"
end
makerule linuxbios_c.o
depends "$(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
action "$(CC) -nostdlib -r -o $@ c_start.o $(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
end
makerule linuxbios_c
depends "linuxbios_c.o $(TOP)/src/config/linuxbios_c.ld ldoptions"
action "$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_c.ld linuxbios_c.o"
action "$(CROSS_COMPILE)nm -n linuxbios_c | sort > linuxbios_c.map"
end
##
## By default compress the C part of linuxbios
##
makedefine LINUXBIOS_PAYLOAD-$(CONFIG_COMPRESS):=linuxbios_payload.nrv2b
makedefine LINUXBIOS_PAYLOAD-$(CONFIG_UNCOMPRESSED):=linuxbios_payload.bin
makerule linuxbios_payload.bin
depends "linuxbios_c"
action "$(OBJCOPY) -O binary $< $@"
end
makerule linuxbios_payload.nrv2b
depends "linuxbios_payload.bin nrv2b"
action "./nrv2b e $< $@"
end
makerule linuxbios_payload
depends "$(LINUXBIOS_PAYLOAD-1)"
action "cp $(LINUXBIOS_PAYLOAD-1) linuxbios_payload"
end
makerule linuxbios
depends "crt0.o $(INIT-OBJECTS) linuxbios_payload ldscript.ld"
action "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o $(INIT-OBJECTS)"
action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
end
makerule linuxbios.a
depends "$(OBJECTS)"
action "rm -f linuxbios.a"
action "ar cr linuxbios.a $(OBJECTS)"
end
#makerule crt0.S
# depends "$(CRT0)"
# action "cp $< $@"
#end
# the buildrom tool
makerule buildrom
depends "$(TOP)/util/buildrom/buildrom.c"
action "$(HOSTCC) -o $@ $<"
end
# Force crt0.s (which has build time version code in it to rebuild every time)
makedefine .PHONY : crt0.s
makerule crt0.s
depends "crt0.S $(CRT0_INCLUDES)"
action "@echo \"$(CPP) ... $< > $@ \""
action "$(CPP) $(CPPFLAGS) -I. -I$(TOP)/src $< > $@.new && mv $@.new $@"
end
makerule crt0.o
depends "crt0.s"
action "@echo $(CC) ... -o $@ $<"
action "@$(CC) -c $(CPU_OPT) -o $@ $<"
end
makerule etags
depends "$(SOURCES)"
action "etags $(SOURCES)"
end
makerule tags
depends "$(SOURCES)"
action "ctags $(SOURCES)"
end
makerule documentation
depends "$(SOURCES)"
action "doxygen LinuxBIOSDoc.config"
end
makerule ./romcc
depends "$(TOP)/util/romcc/romcc.c"
action "$(HOSTCC) -g $(HOSTCFLAGS) -DVERSION='\"0.38\"' -DRELEASE_DATE='\"18 December 2003\"' $< -o $@"
end
makerule build_opt_tbl
depends "$(TOP)/util/options/build_opt_tbl.c $(TOP)/src/include/pc80/mc146818rtc.h $(TOP)/src/include/boot/linuxbios_tables.h Makefile.settings Makefile"
action "$(HOSTCC) $(HOSTCFLAGS) $(CPUFLAGS) $< -o $@"
end
#makerule /$(TARGET_DIR)/option_table.c
# depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
# action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout"
#end
makerule option_table.c
depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
end
makerule option_table.h
depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
end
if HAVE_OPTION_TABLE
object ./option_table.o
#special rule
#makerule option_table.o
# depends "option_table.c"
# action "$(CC) -c $(CFLAGS) -o $@ $<"
#end
# object option_table.o
end
makerule clean
action "rm -f linuxbios.* *~"
action "rm -f linuxbios"
action "rm -f ldscript.ld"
action "rm -f a.out *.s *.l *.o *.E *.inc"
action "rm -f TAGS tags romcc"
action "rm -f docipl buildrom chips.c *chip.c linuxbios_c* linuxbios_pay*"
action "rm -f build_opt_tbl option_table.c crt0.S"
end
# do standard config files that the user need not specify
# for now, this is just 'lib', but it may be more later.
dir /lib
dir /console
dir /stream
dir /devices
dir /pc80
dir /boot
|