1 ## This is Architecture independant part of the makefile
5 makedefine CPP:= $(CC) -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 CFLAGS := $(CPU_OPT) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin -Wall
12 makedefine HOSTCFLAGS:= -Os -Wall
15 depends "ldoptions $(LDSUBSCRIPTS-1)"
16 action "echo \"INCLUDE ldoptions\" > $@ ; for file in $(LDSUBSCRIPTS-1) ; do echo \"INCLUDE $$file\" >> $@ ; done"
20 # depends "Makefile.settings"
21 # 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\"} }' > $@"
25 # depends "Makefile.settings"
26 # 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\"; }}' > $@"
29 makerule linuxbios.strip
31 action "$(OBJCOPY) -O binary linuxbios linuxbios.strip"
34 makerule linuxbios_ram.o
35 depends "$(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
36 action "$(CC) -nostdlib -r -o $@ c_start.o $(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
39 makerule linuxbios_ram
40 depends "linuxbios_ram.o $(TOP)/src/config/linuxbios_ram.ld ldoptions"
41 action "$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_ram.ld linuxbios_ram.o"
42 action "$(CROSS_COMPILE)nm -n linuxbios_ram | sort > linuxbios_ram.map"
46 ## By default compress the part of linuxbios that runs from RAM
48 makedefine LINUXBIOS_RAM-$(CONFIG_COMPRESS):=linuxbios_ram.nrv2b
49 makedefine LINUXBIOS_RAM-$(CONFIG_UNCOMPRESSED):=linuxbios_ram.bin
51 makerule linuxbios_ram.bin
52 depends "linuxbios_ram"
53 action "$(OBJCOPY) -O binary $< $@"
56 makerule linuxbios_ram.nrv2b
57 depends "linuxbios_ram.bin nrv2b"
58 action "./nrv2b e $< $@"
61 makerule linuxbios_ram.rom
62 depends "$(LINUXBIOS_RAM-1)"
63 action "cp $(LINUXBIOS_RAM-1) linuxbios_ram.rom"
67 depends "crt0.o $(INIT-OBJECTS) linuxbios_ram.rom ldscript.ld"
68 action "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o $(INIT-OBJECTS)"
69 action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
74 action "rm -f linuxbios.a"
75 action "ar cr linuxbios.a $(OBJECTS)"
85 depends "$(TOP)/util/buildrom/buildrom.c"
86 action "$(HOSTCC) -o $@ $<"
89 # Force crt0.s (which has build time version code in it to rebuild every time)
90 makedefine .PHONY : crt0.s
92 depends "crt0.S $(CRT0_INCLUDES)"
93 action "@echo \"$(CPP) ... $< > $@ \""
94 action "$(CPP) $(CPPFLAGS) -I. -I$(TOP)/src $< > $@.new && mv $@.new $@"
99 action "@echo $(CC) ... -o $@ $<"
100 action "@$(CC) -c $(CPU_OPT) -o $@ $<"
105 action "etags $(SOURCES)"
109 action "ctags $(SOURCES)"
111 makerule documentation
113 action "doxygen LinuxBIOSDoc.config"
117 depends "$(TOP)/util/romcc/romcc.c"
118 action "$(HOSTCC) -g $(HOSTCFLAGS) $< -o $@"
121 makerule build_opt_tbl
122 depends "$(TOP)/util/options/build_opt_tbl.c $(TOP)/src/include/pc80/mc146818rtc.h $(TOP)/src/include/boot/linuxbios_tables.h Makefile.settings Makefile"
123 action "$(HOSTCC) $(HOSTCFLAGS) $(CPUFLAGS) $< -o $@"
126 #makerule /$(TARGET_DIR)/option_table.c
127 # depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
128 # action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout"
131 makerule option_table.c
132 depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
133 action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
136 makerule option_table.h
137 depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
138 action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
142 object ./option_table.o
144 #makerule option_table.o
145 # depends "option_table.c"
146 # action "$(CC) -c $(CFLAGS) -o $@ $<"
148 # object option_table.o
152 action "rm -f linuxbios.* *~"
153 action "rm -f linuxbios"
154 action "rm -f ldscript.ld"
155 action "rm -f a.out *.s *.l *.o *.E *.inc"
156 action "rm -f TAGS tags romcc"
157 action "rm -f docipl buildrom chips.c *chip.c linuxbios_ram* linuxbios_pay*"
158 action "rm -f build_opt_tbl option_table.c crt0.S"
161 # do standard config files that the user need not specify
162 # for now, this is just 'lib', but it may be more later.