File: Makefile.am

package info (click to toggle)
faumachine 20100527-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 53,836 kB
  • ctags: 20,552
  • sloc: ansic: 179,550; asm: 3,645; makefile: 3,611; perl: 2,103; sh: 1,529; python: 600; xml: 563; lex: 210; vhdl: 204
file content (193 lines) | stat: -rw-r--r-- 5,799 bytes parent folder | download
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
## Process this file with automake to produce Makefile.in
# $Id: Makefile.am,v 1.36 2009-07-29 07:30:06 vrsieh Exp $
#
# Copyright (C) 2004-2009 FAUmachine Team <info@faumachine.org>.
#
# This program is free software. You can redistribute it and/or modify it
# under the terms of the GNU General Public License, either version 2 of
# the License, or (at your option) any later version. See COPYING.


CONFIG = -DCONFIG_80286_SUPPORT

IASL=@IASL@
INCLUDE = -I. -I../bios -I.. -I../..
CFLAGS = $(filter-out -g, $(filter-out -finline-limit-100000, $(filter-out -O2,@CFLAGS@))) -Os -fomit-frame-pointer -mpreferred-stack-boundary=2 --freestanding -falign-functions=15 $(INCLUDE)
CCASFLAGS = $(CONFIG)

if HOST_X86_64
CCASFLAGS += -m32
CFLAGS += -m32
endif

MAPFILE = bios.gcc.map
LINK_SCRIPT = bios.lds.in

# little trick to compile & assemble with gcc.pl
CC = ./gcc.pl "@FAUCC@ -b i286 -f sizeof_int=2 -f sizeof_pointer=4"
CCAS = ./gcc.pl "@CCAS@"

ASMBAK_EXT = .s_orig
ASMPATCH_EXT = .s_patch

xpm2logo=${top_builddir}/scripts/xpm2logo
bin2bios=${top_builddir}/scripts/bin2bios
splitbios=${top_builddir}/scripts/splitbios
libfaucc= @LIBFAUCC@
LDSCRIPT_PATCHER = ./ldscript_patcher.pl
###PREASM_PATCHER = ./preasm_patcher.pl 
###PREASM_PROC = ./preasm_proc.pl

init_rm_flags = -DINIT_RM -DCONFIG_80286_SUPPORT --sec-prefix=.init.rm
rt_pm_flags = -DRUNTIME_PM -DCONFIG_80286_SUPPORT --sec-prefix=.rt.pm_legacy 
rt_rm_flags = -DRUNTIME_RM -DCONFIG_80286_SUPPORT --sec-prefix=.rt.rm_legacy 

bios_clfags = -I${top_srcdir} --freestanding
bios_casflags = -D__ASSEMBLY__ -I${top_srcdir}

if BUILD_BIOS

rom_DATA = \
	mb_ibm_at_bios.rom-0 \
	mb_ibm_at_bios.rom-1 \
	mb_ibm_at_bios.rom-2 \
	mb_ibm_at_bios.rom-3
noinst_PROGRAMS = bios.elf1
noinst_DATA = bios.elf bios.dis16 bios.dis32

# C sources for realmode part
C_sources = ../bios/main.c ../bios/disk.c ../bios/kbd.c ../bios/mem.c ../bios/traps.c ../bios/video.c \
		../bios/boot.c setup.c ../bios/serial.c \
		../bios/parallel.c ../bios/shutcode.c ../bios/hwconfig.c ../bios/in.c ../bios/assert.c \
		../bios/print.c ../bios/vsprintf.c ../bios/debug.c ../bios/main_init.c \
		../bios/fixme.c ../bios/chipset.c ../bios/cmos.c

# Assembler sources for gas
gas_sources = ../bios/head.S ../bios/post.S ../bios/entry.S ../bios/rtc.S \
		../bios/early_init.S ../bios/memcpy.S

all_sources = $(gas_sources) $(C_sources)
all_modules = $(gas_sources:.S=) $(C_sources:.c=)

CLEANFILES = \
	$(rom_DATA) \
	$(noinst_DATA) \
	logo.h \
	$(MAPFILE) \
	faum-dsdt.h \
	$(LINK_SCRIPT:.in=) \
	mb_ibm_at_bios.rom
	
BUILT_SOURCES = logo.h faum-dsdt.h
noinst_LIBRARIES = libinit_rm.a librt_pm.a librt_rm.a

libinit_rm_a_SOURCES = $(all_sources)
libinit_rm_a_CFLAGS = $(init_rm_flags) $(bios_clfags) 
libinit_rm_a_CCASFLAGS = $(init_rm_flags) $(bios_casflags) 

librt_pm_a_SOURCES = $(all_sources)
librt_pm_a_CFLAGS = $(rt_pm_flags) $(bios_clfags) 
librt_pm_a_CCASFLAGS =  $(rt_pm_flags) $(bios_casflags) 

librt_rm_a_SOURCES = $(all_sources)
librt_rm_a_CFLAGS = $(rt_rm_flags) $(bios_clfags) 
librt_rm_a_CCASFLAGS =  $(rt_rm_flags) $(bios_casflags) 

bios_elf1_SOURCES = 
bios_elf1_CFLAGS = $(bios_cflags)
bios_elf1_CCASFLAGS = $(bios_casflags)
bios_elf1_LDFLAGS = -Xlinker --whole-archive  \
	-T ${srcdir}/$(LINK_SCRIPT:.in=) -static -nostdlib \
	-Xlinker -Map -Xlinker $(MAPFILE) -Xlinker --cref
bios_elf1_DEPENDENCIES = ${srcdir}/$(LINK_SCRIPT:.in=) \
	libinit_rm.a \
	librt_rm.a librt_pm.a \
	$(libfaucc)

bios_elf1_LDADD = \
	libinit_rm.a \
	librt_rm.a librt_pm.a \
	$(libfaucc)



$(LINK_SCRIPT:.in=): $(LINK_SCRIPT) $(LDSCRIPT_PATCHER) \
		libinit_rm.a \
		librt_rm.a librt_pm.a \
		$(libfaucc)


##	Preprocess ld-script	
	cpp -I../bios -P $<  > $(<:.in=.patched) 
## 	Patch ld-script
	$(LDSCRIPT_PATCHER) $(<:.in=.patched) $(<:.in=) \
		libinit_rm.a \
		librt_rm.a librt_pm.a \
		$(libfaucc)

	rm $(<:.in=.patched)

check-local:
	if grep -q 'switch\W*(.*)' *.c; then exit 1; fi
	if test -z "`$(OBJDUMP) -h bios.elf | grep '\.bss[[:blank:]]\+0\+[[:blank:]]\+'`"; then  \
		echo -e 'BIOS contains bss data\n'; exit 1; fi

bios.elf: bios.elf1$(EXEEXT)
##	set section flags
##	$(OBJCOPY) --set-section-flags .text.reset=contents,alloc,load,readonly,code $< $@
	cp $< $@

bios.dis16 bios.dis32: bios.elf
if HAVE_OBJDUMP
	$(OBJDUMP) -D -r --disassembler-options=att,i8086 $< > bios.dis16
	$(OBJDUMP) -D -r --disassembler-options=att       $< > bios.dis32
endif

mb_ibm_at_bios.rom: bios.elf
	$(OBJCOPY) -O binary $< bios.text
	$(bin2bios) bios.text > $@
	rm bios.text

mb_ibm_at_bios.rom-0 mb_ibm_at_bios.rom-1 mb_ibm_at_bios.rom-2 mb_ibm_at_bios.rom-3: mb_ibm_at_bios.rom
	$(splitbios) 1 2 32768 mb_ibm_at_bios.rom

logo.h: $(xpm2logo) ../../../lib/logo.epa
	$(xpm2logo) < ../../../lib/logo.epa > $@

debug:
	echo $(all_modules);

if HAVE_IASL
faum-dsdt.h: ../bios/faum-dsdt.asl
	$(IASL) -p faum-dsdt -on -tc $<
	$(RM) faum-dsdt.aml
	mv faum-dsdt.hex $@
else
faum-dsdt.h: ../bios/faum-dsdt.h.shipped
	cp $< $@
endif

# arg, automake does not generate dependencies for .S files yet :(

entry_deps = ../bios/entry.S ../bios/libsys.h ../bios/build_config.h
head_deps = ../bios/head.S ../bios/libsys.h ../bios/build_config.h
post_deps = ../bios/post.S ../bios/libsys.h ../bios/build_config.h
reset_deps = ../bios/reset.S ../bios/libsys.h ../bios/build_config.h

libinit_rm_a-entry.$(OBJEXT): $(entry_deps)
libinit_rm_a-head.$(OBJEXT): $(head_deps)
libinit_rm_a-post.$(OBJEXT): $(post_deps)
libinit_rm_a-reset.$(OBJEXT): $(reset_deps) 

librt_pm_a-entry.$(OBJEXT): $(entry_deps)
librt_pm_a-head.$(OBJEXT): $(head_deps)
librt_pm_a-post.$(OBJEXT): $(post_deps)
librt_pm_a-reset.$(OBJEXT): $(reset_deps) 

librt_rm_a-entry.$(OBJEXT): $(entry_deps)
librt_rm_a-head.$(OBJEXT): $(head_deps)
librt_rm_a-post.$(OBJEXT): $(post_deps)
librt_rm_a-reset.$(OBJEXT): $(reset_deps) 

endif