summaryrefslogtreecommitdiff
path: root/i386/Makefrag
blob: 18479c62ce6f6dda775516f4053b17904cf39c00 (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
170
171
172
173
174
175
176
177
178
179
# i386 Mach makefile fragment
# Copyright 1997 Free Software Foundation, Inc.
#
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS
# "AS IS" CONDITION.  THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
# LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
# USE OF THIS SOFTWARE.


# Some of the i386-specific code checks for these.
DEFINES += -DCONTINUATIONS -DLINUX_DEV -D__ELF__ -Di386

# Source files for any i386 kernel
i386at-files = autoconf.c blit.c com.c conf.c cons_conf.c fd.c rtc.c \
	i386at_ds_routines.c immc.c int_init.c iopl.c kd.c kd_event.c \
	kd_mouse.c kd_queue.c model_dep.c phys_mem_grab_page.c pic_isa.c
i386-files = ast_check.c db_disasm.c db_interface.c db_trace.c debug_i386.c \
	fpe_linkage.c fpu.c gdt.c hardclock.c idt.c io_emulate.c io_map.c \
	iopb.c ktss.c kttd_interface.c ldt.c loose_ends.c mp_desc.c pcb.c \
	phys.c pic.c pit.c seg.c trap.c user_ldt.c
intel-files = pmap.c read_fault.c

# Assembler source
i386at-Sfiles = boothdr.S interrupt.S kdasm.S
i386-Sfiles = cswitch.S debug_trace.S idt_inittab.S locore.S spl.S

# Account for them in the image
objfiles += $(subst .c,.o,$(i386at-files) $(i386-files) $(intel-files)) \
	    $(subst .S,.o,$(i386at-Sfiles) $(i386-Sfiles))
vpath %.c $(sysdep)/i386at $(sysdep)/i386 $(sysdep)/intel
vpath %.S $(sysdep)/i386at $(sysdep)/i386

# Files from the generic source that we want
objfiles += busses.o cirbuf.o
vpath busses.c $(srcdir)/chips

# FPE emulation
objfiles += fpe.o

# Mig-generated
objfiles += mach_i386_server.o

### Linux device drivers (make this Better, Please)

linux-gen-files = $(addprefix linux_,$(linux-gen-names))
linux-gen-names = autoirq.c block.c dma.c init.c irq.c kmem.c misc.c net.c \
		port.c printk.c sched.c soft.c timer.c version.c vsprintf.c

linux-block-files = cmd640.c floppy.c genhd.c ide-cd.c ide.c rz1000.c triton.c

linux-net-files = 3c501.c 3c503.c 3c505.c 3c507.c 3c509.c 3c59x.c \
	8390.c Space.c ac3200.c apricot.c at1700.c atp.c \
	de4x5.c de600.c de620.c depca.c dev.c e2100.c eepro.c eexpress.c \
	eth16i.c ewrk3.c hp-plus.c hp.c hp100.c lance.c ne.c net_init.c \
	ni52.c ni65.c seeq8005.c sk_g16.c smc-ultra.c tulip.c \
	wavelan.c wd.c znet.c

linux-pci-files = bios32.c pci.c

linux-scsi-files = 53c7,8xx.c AM53C974.c BusLogic.c NCR53c406a.c advansys.c \
	aha152x.c aha1542.c aha1740.c aic7xxx.c constants.c eata.c eata_dma.c \
	eata_pio.c fdomain.c g_NCR5380.c hosts.c in2000.c pas16.c qlogic.c \
	scsi.c scsi_debug.c scsi_ioctl.c scsi_proc.c scsicam.c sd.c \
	sd_ioctl.c seagate.c sr.c sr_ioctl.c t128.c u14-34f.c \
	ultrastor.c wd7000.c

all-linux-files = $(linux-gen-files) $(linux-block-files) \
		$(linux-net-files) $(linux-pci-files) $(linux-scsi-files)

# These are always used.
objfiles += $(subst .c,.o,$(filter-out linux_net.c,$(linux-gen-files)))
objfiles += $(subst .c,.o,$(linux-pci-files)) genhd.o

vpath %.c $(sysdep)/i386at/gpl/linux $(sysdep)/i386at/gpl/linux/block
vpath %.c $(sysdep)/i386at/gpl/linux/net $(sysdep)/i386at/gpl/linux/pci
vpath %.c $(sysdep)/i386at/gpl/linux/scsi

# These files need special flags for compilation; each one will
# have a variable like wd7000.c-linux-flags with those flags.
CFLAGS += $($(<F)-linux-flags)

# These flags are:
# Instead of Mach's KERNEL, Linux uses __KERNEL__.  Whee.
# Arrange for special include directories too.
# Because of the use of `extern inline' in some Linux header files without
# corresponding text-segment definitions, we must always optimize.
linux-spec-flags= -D__KERNEL__ -I$(sysdep)/i386at/gpl/linux \
	-I$(sysdep)/i386at/gpl/linux/include -O2

# Here is where those specs are found.
include linux-flags

# How to make this file:

linux-flags: $(sysdep)/Makefrag
	rm -f $@
	for i in $(all-linux-files); do \
		echo $$i-linux-flags '= $$(linux-spec-flags)' >> $@; \
	done
	echo 'linux-flags-done='$(all-linux-files) >> $@

# If we haven't included `linux-flags' properly, then don't try and build
# .d files.
ifneq ($(linux-flags-done),$(all-linux-files))
no_deps=t
endif

### End Linux device drivers grot



include i386/driverlist
objfiles += $(device_drivers)



# Where to find some things
vpath i386asm.sym $(sysdep)/i386
vpath mach_i386.srv $(sysdep)/i386

# Make sure boothdr.o is at the very front
objfiles := boothdr.o $(filter-out boothdr.o,$(objfiles))

# Our include files are here; make sure they PRECEDE the generic ones.
INCLUDES := -I$(sysdep)/i386at -I$(sysdep)/i386 \
	-I$(sysdep)/include -I$(sysdep)/include/mach/sa \
	-I$(sysdep)/bogus -I$(sysdep) \
	$(INCLUDES)

# arrange suitable load address
LDFLAGS += -Ttext 100000

# Assemble .S files correctly
ASFLAGS += -DASSEMBLER

boothdr.o: i386asm.h 


# Header files we install

# We have our own version of this file
installed-headers := $(filter-out mach/proc_ops.h,$(installed-headers))

i386-installed-headers= mach/proc_ops.h \
		$(addprefix mach/i386/,asm.h bios.h boolean.h code16.h \
		debug_reg.h disk.h dpmi.h eflags.h exception.h far_ptr.h \
		fp_reg.h ioccom.h kern_return.h mach_i386.defs \
		mach_i386_types.h machine_types.defs multiboot.h paging.h \
		pio.h pmode.h proc_reg.h rpc.h seg.h syscall_sw.h \
		thread_status.h time_stamp.h trap.h tss.h vcpi.h vm_param.h \
		vm_types.h)


# Autoconf support

$(sysdep)/configure: $(sysdep)/Drivers.in $(srcdir)/Drivers.macros
	cd $(sysdep) && rm -f configure && autoconf Drivers.in > configure

$(systype)/device-drivers.h $(systype)/driverlist: $(sysdep)/driverlist.in $(systype)/config.status
	cd $(systype) && ./config.status

$(systype)/config.status: $(sysdep)/configure
	cd $(systype) && ./config.status --recheck




# Cheat, cheat, cheat.
fpe.o: fpe.b_elf
	uudecode $<
vpath fpe.b_elf $(sysdep)/i386

fpe.d:; touch $@