|
|
1.1 root 1: # Makefile for Linux device drivers and the glue codes.
2: # Copyright 1998, 1999 Free Software Foundation, Inc.
3: #
4: # Permission to use, copy, modify and distribute this software and its
5: # documentation is hereby granted, provided that both the copyright
6: # notice and this permission notice appear in all copies of the
7: # software, derivative works or modified versions, and any portions
8: # thereof, and that both notices appear in supporting documentation.
9: #
10: # THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS
11: # "AS IS" CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
12: # LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
13: # USE OF THIS SOFTWARE.
14:
15:
16: # Variables from `configure'.
17: srcdir=@srcdir@
18: systype=@systype@
19: device_drivers=@device_drivers@
20:
21: sysdep=$(srcdir)/..
22: linuxdir=../../linux
23: linuxsrcdir=$(srcdir)/$(linuxdir)
24:
25: # Programs found by configure.
26: CC = @CC@
27: LD = @LD@
28:
29: CFLAGS = @CFLAGS@
30:
31:
32:
33: # Files for driver support.
1.1.1.2 ! root 34: linux-c-files = version.c softirq.c delay.c dma.c resource.c printk.c \
1.1 root 35: bios32.c irq.c ctype.c vsprintf.c main.c misc.c sched.c \
36: kmem.c block.c setup.c
37:
38: # `dev' directory contains modified and glue source files.
39: vpath %.c $(linuxsrcdir)/dev/kernel
40: vpath %.c $(linuxsrcdir)/dev/init
41: vpath %.c $(linuxsrcdir)/dev/arch/$(systype)/kernel
1.1.1.2 ! root 42: vpath %.c $(linuxsrcdir)/dev/arch/$(systype)/lib
1.1 root 43: vpath %.c $(linuxsrcdir)/dev/glue
44: vpath %.c $(linuxsrcdir)/dev/lib
45:
46: # `src' directory contains original Linux source files.
47: vpath %.c $(linuxsrcdir)/src/kernel
48: vpath %.c $(linuxsrcdir)/src/init
49: vpath %.c $(linuxsrcdir)/src/arch/$(systype)/kernel
1.1.1.2 ! root 50: vpath %.c $(linuxsrcdir)/src/arch/$(systype)/lib
1.1 root 51: vpath %.c $(linuxsrcdir)/src/lib
52:
53:
54: # XXX: Assembly source files must be treated separately... Uggg...
1.1.1.2 ! root 55: linux-asm-files = semaphore.S
1.1 root 56: vpath %.S $(linuxsrcdir)/dev/arch/$(systype)/lib
57: vpath %.S $(linuxsrcdir)/src/arch/$(systype)/lib
58:
59:
60: # Linux device drivers.
61: linux-block-files = cmd640.c floppy.c genhd.c ide-cd.c ide.c rz1000.c triton.c
62: vpath %.c $(linuxsrcdir)/dev/drivers/block
63: vpath %.c $(linuxsrcdir)/src/drivers/block
64:
65: linux-net-files = auto_irq.c 3c501.c 3c503.c 3c505.c 3c507.c 3c509.c \
66: 3c59x.c 3c515.c 8390.c Space.c ac3200.c apricot.c at1700.c atp.c \
67: de4x5.c de600.c de620.c depca.c dev.c e2100.c eepro.c eepro100.c \
68: eexpress.c epic100.c eth16i.c ewrk3.c fmv18x.c hp-plus.c hp.c hp100.c \
69: lance.c ne.c ne2k-pci.c net_init.c ni52.c ni65.c pcnet32.c rtl8139.c \
70: seeq8005.c sk_g16.c smc-ultra.c smc-ultra32.c tlan.c tulip.c \
71: via-rhine.c wavelan.c wd.c yellowfin.c znet.c net.c
72: vpath %.c $(linuxsrcdir)/dev/drivers/net
73: vpath %.c $(linuxsrcdir)/dev/net/core
74: vpath %.c $(linuxsrcdir)/src/drivers/net
75: vpath %.c $(linuxsrcdir)/src/net/core
76:
77: linux-pci-files = pci.c
78: vpath %.c $(linuxsrcdir)/dev/drivers/pci
79: vpath %.c $(linuxsrcdir)/src/drivers/pci
80:
81: linux-scsi-files = 53c78xx.c AM53C974.c BusLogic.c NCR53c406a.c advansys.c \
82: aha152x.c aha1542.c aha1740.c aic7xxx.c constants.c dtc.c eata.c \
83: eata_dma.c eata_pio.c fdomain.c g_NCR5380.c gdth.c hosts.c in2000.c \
84: ncr53c8xx.c pas16.c ppa.c qlogicfas.c qlogicisp.c scsi.c scsi_ioctl.c \
85: scsi_proc.c scsicam.c sd.c sd_ioctl.c seagate.c sr.c sr_ioctl.c \
1.1.1.2 ! root 86: t128.c tmscsim.c u14-34f.c ultrastor.c wd7000.c
1.1 root 87: vpath %.c $(linuxsrcdir)/dev/drivers/scsi
88: vpath %.c $(linuxsrcdir)/src/drivers/scsi
89:
90:
91: all-linux-files = $(linux-c-files) $(linux-block-files) \
92: $(linux-net-files) $(linux-pci-files) $(linux-scsi-files)
93:
94: # These are always used.
95: linux-objs := $(subst .c,.o, $(linux-c-files) $(linux-pci-files)) genhd.o
96: linux-objs += $(subst .S,.o, $(linux-asm-files))
97:
98: # These files need special flags for compilation; each one will
99: # have a variable like wd7000.c-linux-flags with those flags.
100: CFLAGS += $($(<F)-linux-flags)
101: ASFLAGS += $($(<F)-linux-flags)
102:
103: CPPFLAGS = -DMACH -DCMU -DMACH_KERNEL -DKERNEL -DLINUX_DEV \
104: -DCONTINUATIONS -D__ELF__ -Di386 \
105: -I. -I.. -I$(srcdir)/.. -I../.. -I$(srcdir)/../.. \
106: -I$(srcdir)/../../include -I$(srcdir)/../../bogus \
107: -I$(srcdir)/../../util -I$(srcdir)/../../kern \
108: -I$(srcdir)/../../device -I$(sysdep)/i386at -I$(sysdep)/i386 \
109: -I$(sysdep)/include -I$(sysdep)/include/mach/sa -I$(sysdep)/bogus \
110: -I$(sysdep) -Wall
111:
112: # These flags are:
113: # Instead of Mach's KERNEL, Linux uses __KERNEL__. Whee.
114: # Arrange for special include directories too.
115: # Because of the use of `extern inline' in some Linux header files without
116: # corresponding text-segment definitions, we must always optimize.
117: linux-gen-flags = -D__KERNEL__ -O2 \
118: -Idev/include -I$(srcdir)/dev/include \
119: -I$(linuxdir)/dev/include -I$(linuxdir)/src/include \
120: -I$(linuxsrcdir)/dev/include -I$(linuxsrcdir)/src/include
121: linux-block-flags = -I$(linuxsrcdir)/dev/drivers/block \
122: -I$(linuxsrcdir)/src/drivers/block
123: linux-net-flags = -I$(linuxsrcdir)/dev/drivers/net \
124: -I$(linuxsrcdir)/src/drivers/net
125: linux-pci-flags = -I$(linuxsrcdir)/dev/drivers/pci \
126: -I$(linuxsrcdir)/src/drivers/pci
127: linux-scsi-flags = -I$(linuxsrcdir)/dev/drivers/scsi \
128: -I$(linuxsrcdir)/src/drivers/scsi
129: linux-asm-spec-flags = -D__KERNEL__ -D__ASSEMBLY__ -traditional \
130: -Idev/include -I$(linuxdir)/dev/include -I$(linuxdir)/src/include \
131: -I$(srcdir)/dev/include -I$(linuxsrcdir)/dev/include \
132: -I$(linuxsrcdir)/src/include
133:
134:
135: # Here is where those specs are found.
136: -include linux-flags
137:
138: # How to make this file:
139:
140: linux-flags: Makefile
141: rm -f $@
142: for i in $(linux-c-files); do \
143: echo $$i-linux-flags '= $$(linux-gen-flags)' >> $@; \
144: done
145: for i in $(linux-block-files); do \
146: echo $$i-linux-flags \
147: '= $$(linux-gen-flags) $$(linux-block-flags)' >> $@; \
148: done
149: for i in $(linux-net-files); do \
150: echo $$i-linux-flags \
151: '= $$(linux-gen-flags) $$(linux-net-flags)' >> $@; \
152: done
153: for i in $(linux-pci-files); do \
154: echo $$i-linux-flags \
155: '= $$(linux-gen-flags) $$(linux-pci-flags)' >> $@; \
156: done
157: for i in $(linux-scsi-files); do \
158: echo $$i-linux-flags \
159: '= $$(linux-gen-flags) $$(linux-scsi-flags)' >> $@; \
160: done
161: for i in $(linux-asm-files); do \
162: echo $$i-linux-flags '= $$(linux-asm-spec-flags)' >> $@; \
163: done
164: echo 'linux-flags-done='$(all-linux-files) $(linux-asm-files) >> $@
165:
166: # If we haven't included `linux-flags' properly, then don't try and build
167: # .d files.
168: ifneq ($(linux-flags-done),$(all-linux-files) $(linux-asm-files))
169: no_deps=t
170: endif
171:
172: linux-objs += $(sort $(device_drivers))
173:
174:
175:
176: # Autoconf support
177:
178: $(srcdir)/configure: $(srcdir)/Drivers.in $(srcdir)/../../Drivers.macros
179: cd $(srcdir) && rm -f configure && autoconf Drivers.in > configure
180:
181: device-drivers.h: $(srcdir)/Makefile.in config.status
182: ./config.status
183:
184: config.status: $(srcdir)/configure
185: ./config.status --recheck
186:
187: vpath %.in $(srcdir)
188: vpath configure $(srcdir)
189:
190:
191:
192: # Create a linuxdev object file.
193: all: linux.o
194:
195: linux.o: $(linux-objs) $(srcdir)/configure
196: rm -f $@
197: $(LD) -r -o $@ $(linux-objs)
198:
199: clean:
200: rm -f $(linux-objs) linux.o
201:
202: distclean: clean
203: rm -f $(linuxdir)/src/include/asm $(linuxdir)/dev/include/asm
204: rm -f config.status config.log Makefile device-drivers.h
205:
206: mostlyclean: distclean
207:
208: maintainer-clean: mostlyclean
209: rm -f $(srcdir)/configure
1.1.1.2 ! root 210:
! 211:
! 212:
! 213: #
! 214: # Dependency generation
! 215: #
! 216:
! 217: # Include dependency files
! 218: ifneq ($(no_deps),t)
! 219:
! 220: # For each .o file we need a .d file.
! 221: -include $(subst .o,.d,$(filter %.o,$(linux-objs))) /dev/null
! 222:
! 223: endif
! 224:
! 225: # Generic rule for $(CC) based compilation for making dependencies
! 226: define make-deps
! 227: set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M -MG $< | \
! 228: sed > [email protected] -e 's/$*\.o:/$*.o $@:/'
! 229: mv -f [email protected] $@
! 230: endef
! 231:
! 232: %.d: %.c $(before-compile); $(make-deps)
! 233: %.d: %.S $(before-compile); $(make-deps)
! 234:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.