1# $Id: Makefile,v 1.69 2001/11/19 04:09:53 davem Exp $
2# Makefile for the linux kernel.
3#
4
5SH = $(CONFIG_SHELL)
6
7USE_STANDARD_AS_RULE := true
8EXTRA_AFLAGS := -ansi
9
10all: kernel.o head.o init_task.o
11
12O_TARGET := kernel.o
13
14export-objs	:= sparc64_ksyms.o
15obj-y		:= process.o setup.o cpu.o idprom.o \
16		   traps.o devices.o auxio.o \
17		   irq.o ptrace.o time.o sys_sparc.o signal.o \
18		   unaligned.o central.o pci.o starfire.o semaphore.o \
19		   power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o
20
21obj-$(CONFIG_PCI)	 += ebus.o isa.o pci_common.o pci_iommu.o \
22			    pci_psycho.o pci_sabre.o pci_schizo.o
23obj-$(CONFIG_SMP)	 += smp.o trampoline.o
24obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o ioctl32.o
25obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
26obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o
27
28ifdef CONFIG_SUNOS_EMUL
29  obj-y += sys_sunos32.o sunos_ioctl32.o
30else
31  ifdef CONFIG_SOLARIS_EMUL
32    obj-y += sys_sunos32.o sunos_ioctl32.o
33  endif
34endif
35
36head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \
37	etrap.S rtrap.S winfixup.S entry.S
38	$(CC) $(AFLAGS) -ansi -c $*.S -o $*.o
39
40#
41# This is just to get the dependencies...
42#
43binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
44
45ifneq ($(NEW_GCC),y)
46  CMODEL_CFLAG := -mmedlow
47else
48  CMODEL_CFLAG := -m64 -mcmodel=medlow
49endif
50
51check_asm: dummy
52	@if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \
53	  touch $(HPATH)/asm/asm_offsets.h ; \
54	fi
55	@echo "/* Automatically generated. Do not edit. */" > asm_offsets.h
56	@echo "#ifndef __ASM_OFFSETS_H__" >> asm_offsets.h
57	@echo "#define __ASM_OFFSETS_H__" >> asm_offsets.h
58	@echo >> asm_offsets.h
59	@echo "#include <linux/config.h>" >> asm_offsets.h
60	@echo >> asm_offsets.h
61	@echo "#include <linux/config.h>" > tmp.c
62	@echo "#include <linux/sched.h>" >> tmp.c
63	$(CPP) $(CPPFLAGS) -P tmp.c -o tmp.i
64	@echo "/* Automatically generated. Do not edit. */" > check_asm_data.c
65	@echo "#include <linux/config.h>" >> check_asm_data.c
66	@echo "#include <linux/sched.h>" >> check_asm_data.c
67	@echo 'unsigned int check_asm_data[] = {' >> check_asm_data.c
68	$(SH) ./check_asm.sh -data task tmp.i check_asm_data.c
69	$(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c
70	$(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c
71	@echo '};' >> check_asm_data.c
72	$(CC) $(CPPFLAGS) $(CMODEL_CFLAG) -ffixed-g4 -S -o check_asm_data.s check_asm_data.c
73	@echo "/* Automatically generated. Do not edit. */" > check_asm.c
74	@echo 'extern int printf(const char *fmt, ...);' >>check_asm.c
75	@echo 'unsigned int check_asm_data[] = {' >> check_asm.c
76	$(SH) ./check_asm.sh -ints check_asm_data.s check_asm.c
77	@echo '};' >> check_asm.c
78	@echo 'int main(void) {' >> check_asm.c
79	@echo 'int i = 0;' >> check_asm.c
80	$(SH) ./check_asm.sh -printf task tmp.i check_asm.c
81	$(SH) ./check_asm.sh -printf mm tmp.i check_asm.c
82	$(SH) ./check_asm.sh -printf thread tmp.i check_asm.c
83	@echo 'return 0; }' >> check_asm.c
84	@rm -f tmp.[ci] check_asm_data.[cs]
85	$(HOSTCC) -o check_asm check_asm.c
86	./check_asm >> asm_offsets.h
87	@rm -f check_asm check_asm.c
88	@echo >> asm_offsets.h
89	@echo "#endif /* __ASM_OFFSETS_H__ */" >> asm_offsets.h
90	@if test -r $(HPATH)/asm/asm_offsets.h; then \
91	  if cmp -s asm_offsets.h $(HPATH)/asm/asm_offsets.h; then \
92	    echo $(HPATH)/asm/asm_offsets.h is unchanged; \
93	    rm -f asm_offsets.h; \
94	  else \
95	    mv -f asm_offsets.h $(HPATH)/asm/asm_offsets.h; \
96	  fi; \
97	else \
98	  mv -f asm_offsets.h $(HPATH)/asm/asm_offsets.h; \
99	fi
100
101include $(TOPDIR)/Rules.make
102