xref: /freebsd/sys/conf/Makefile.arm (revision 262e143bd46171a6415a5b28af260a5efa2a3db8)
1# Makefile.arm -- with config changes.
2# Copyright 1990 W. Jolitz
3#	from: @(#)Makefile.i386	7.1 5/10/91
4# $FreeBSD$
5#
6# Makefile for FreeBSD
7#
8# This makefile is constructed from a machine description:
9#	config machineid
10# Most changes should be made in the machine description
11#	/sys/arm/conf/``machineid''
12# after which you should do
13#	 config machineid
14# Generic makefile changes should be made in
15#	/sys/conf/Makefile.arm
16# after which config should be rerun for all machines.
17#
18
19# Which version of config(8) is required.
20%VERSREQ=	600004
21
22# Temporary stuff while we're still embryonic
23NO_MODULES=
24
25STD8X16FONT?=	iso
26
27.if !defined(S)
28.if exists(./@/.)
29S=	./@
30.else
31S=	../../..
32.endif
33.endif
34.include "$S/conf/kern.pre.mk"
35
36SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M}
37SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M}
38
39.if defined(ARM_BIG_ENDIAN)
40CC += -mbig-endian
41SYSTEM_LD += -EB
42.endif
43
44
45.if !defined(DEBUG)
46CFLAGS += -mno-apcs-frame
47STRIP_FLAGS = -S
48.endif
49
50DDB_ENABLED!=	grep DDB opt_ddb.h || true
51
52SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader \
53	  -warn-common -export-dynamic -dynamic-linker /red/herring -o \
54	   ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o
55SYSTEM_LD_TAIL +=; cat ldscript.$M| \
56		sed s/" + SIZEOF_HEADERS"// \
57		>ldscript.$M.noheader; \
58		${SYSTEM_LD_}; \
59		${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \
60		${KERNEL_KO}.bin; \
61		rm ${FULLKERNEL}.noheader
62.if ${DDB_ENABLED} != "" || defined(BUILD_ELF_TRAMPOLINE)
63SYSTEM_LD_TAIL += ;echo "\#define KERNNAME \"${KERNEL_KO}.tmp\"" \
64	>opt_kernname.h ;\
65	${OBJCOPY} ${STRIP_FLAGS} --strip-symbol '$$d' --strip-symbol '$$a' \
66	-g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp;\
67	${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.arm \
68	$S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S -o ${KERNEL_KO}.tramp;\
69	${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.arm.noheader \
70	$S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S -o \
71	${KERNEL_KO}.tramp.noheader; \
72	${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
73	${KERNEL_KO}.tramp.bin; \
74	gzip -9 ${KERNEL_KO}.tmp; \
75	echo "\#define KERNNAME \"${KERNEL_KO}.tmp.gz\"" \
76	>opt_kernname.h ;\
77	eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \
78	echo "\#define KERNSIZE $$st_size" >>opt_kernname.h;\
79	${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.arm \
80	-DKZIP $S/$M/$M/elf_trampoline.c $S/kern/inflate.c $S/$M/$M/inckern.S \
81	-o ${KERNEL_KO}.gz.tramp;\
82	${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.arm.noheader \
83	-DKZIP $S/$M/$M/elf_trampoline.c $S/kern/inflate.c $S/$M/$M/inckern.S \
84	-o ${KERNEL_KO}.tramp.noheader; \
85	${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
86	${KERNEL_KO}.gz.tramp.bin; \
87	rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h;
88.endif
89
90CLEANFILES +=	ldscript.$M ldscript.$M.noheader ${KERNEL_KO}.bin \
91		${KERNEL_KO}.tramp ${KERNEL_KO}.tramp.bin
92%BEFORE_DEPEND
93
94%OBJS
95
96%FILES.c
97
98%FILES.s
99
100%FILES.m
101
102%CLEAN
103
104.if ${DDB_ENABLED} != ""
105CLEAN+=	kernel.tramp
106.endif
107ldscript.$M: $S/conf/ldscript.$M
108	cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
109	  sed s/KERNVIRTADDR/${KERNVIRTADDR}/g > ldscript.$M
110%RULES
111
112.include "$S/conf/kern.post.mk"
113