1 ## This is Architecture independant part of the makefile
5 makedefine CPP:= $(CC) -no-gcc -x assembler-with-cpp -DASSEMBLY -E
6 makedefine LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name)
7 makedefine GCC_INC_DIR := $(shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
9 makedefine CPPFLAGS := -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS)
10 makedefine ROMCCPPFLAGS := -D__ROMCC__=0 -D__ROMCC_MINOR__=34
11 makedefine CFLAGS := $(CPU_OPT) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin -Wall
13 makedefine HOSTCFLAGS:= -Os -Wall
16 depends "ldoptions $(LDSUBSCRIPTS-1)"
17 action "echo \"INCLUDE ldoptions\" > $@ ; for file in $(LDSUBSCRIPTS-1) ; do echo \"INCLUDE $$file\" >> $@ ; done"
21 # depends "Makefile.settings"
22 # 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\"} }' > $@"
26 # depends "Makefile.settings"
27 # 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\"; }}' > $@"
30 makerule linuxbios.strip
32 action "$(OBJCOPY) -O binary linuxbios linuxbios.strip"
35 makerule linuxbios_c.o
36 depends "$(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
37 action "$(CC) -nostdlib -r -o $@ c_start.o $(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
41 depends "linuxbios_c.o $(TOP)/src/config/linuxbios_c.ld ldoptions"
42 action "$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_c.ld linuxbios_c.o"
43 action "$(CROSS_COMPILE)nm -n linuxbios_c | sort > linuxbios_c.map"
47 ## By default compress the C part of linuxbios
49 makedefine LINUXBIOS_PAYLOAD-$(CONFIG_COMPRESS):=linuxbios_payload.nrv2b
50 makedefine LINUXBIOS_PAYLOAD-$(CONFIG_UNCOMPRESSED):=linuxbios_payload.bin
52 makerule linuxbios_payload.bin
54 action "$(OBJCOPY) -O binary $< $@"
57 makerule linuxbios_payload.nrv2b
58 depends "linuxbios_payload.bin nrv2b"
59 action "./nrv2b e $< $@"
62 makerule linuxbios_payload
63 depends "$(LINUXBIOS_PAYLOAD-1)"
64 action "cp $(LINUXBIOS_PAYLOAD-1) linuxbios_payload"
68 depends "crt0.o linuxbios_payload ldscript.ld"
69 action "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o"
70 action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
75 action "rm -f linuxbios.a"
76 action "ar cr linuxbios.a $(OBJECTS)"
86 depends "$(TOP)/util/buildrom/buildrom.c"
87 action "$(HOSTCC) -o $@ $<"
90 # Force crt0.s (which has build time version code in it to rebuild every time)
91 makedefine .PHONY : crt0.s
93 depends "crt0.S $(CRT0_INCLUDES)"
94 action "@echo \"$(CPP) ... $< > $@ \""
95 action "$(CPP) $(CPPFLAGS) -I. -I$(TOP)/src $< > $@.new && mv $@.new $@"
99 depends "crt0.s $(INIT-OBJECTS)"
100 action "@echo $(CC) ... -o $@ $<"
101 action "@$(CC) -c $(CPU_OPT) -o $@ $< $(INIT-OBJECTS)"
106 action "etags $(SOURCES)"
110 action "ctags $(SOURCES)"
112 makerule documentation
114 action "doxygen LinuxBIOSDoc.config"
118 depends "$(TOP)/util/romcc/romcc.c"
119 action "$(HOSTCC) -g $(HOSTCFLAGS) -DVERSION='\"0.34\"' -DRELEASE_DATE='\"4 July 2003\"' $< -o $@"
122 makerule build_opt_tbl
123 depends "$(TOP)/util/options/build_opt_tbl.c $(TOP)/src/include/pc80/mc146818rtc.h $(TOP)/src/include/boot/linuxbios_tables.h"
124 action "$(HOSTCC) $(HOSTCFLAGS) $< -o $@"
127 #makerule /$(TARGET_DIR)/option_table.c
128 # depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
129 # action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout"
132 makerule option_table.c
133 depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
134 action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout"
138 object ./option_table.o
140 #makerule option_table.o
141 # depends "option_table.c"
142 # action "$(CC) -c $(CFLAGS) -o $@ $<"
144 # object option_table.o
148 action "rm -f linuxbios.* *~"
149 action "rm -f linuxbios"
150 action "rm -f ldscript.ld"
151 action "rm -f a.out *.s *.l *.o *.E *.inc"
152 action "rm -f TAGS tags romcc"
153 action "rm -f docipl buildrom chips.c *chip.c linuxbios_c* linuxbios_pay*"
154 action "rm -f build_opt_tbl option_table.c crt0.S"
157 # do standard config files that the user need not specify
158 # for now, this is just 'lib', but it may be more later.