source: trunk/source/lisp-kernel/linuxarm/Makefile

Last change on this file was 16741, checked in by gb, 3 years ago

At least a little cross-compilation support for the CCL kernel.

File size: 3.3 KB
Line 
1#
2# Copyright 2010 Clozure Associates
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16SVN_REVISION := "$(shell svnversion || echo unknown)"
17
18# default float-abi to whatever the toolchain defaults to.
19FLOAT_ABI_OPTION =
20VPATH = ../
21# default float-abi to whatever the toolchain defaults to.
22# allow float-abi.mk to override
23FLOAT_ABI_OPTION =
24VPATH = ../
25RM = /bin/rm
26# compile natively,  on a 32-bit ARM v7 running Linux
27CROSS=
28# a plausible cross-compilation prefix, useful on
29# at least an odroid64 running Ubuntu 16.04
30#CROSS=/usr/bin/arm-linux-gnueabihf-
31AS = $(CROSS)as
32CC = $(CROSS)gcc
33M4 = m4
34ASFLAGS = -mfpu=vfp -march=armv7-a $(FLOAT_ABI_OPTION)
35M4FLAGS = -DLINUX -DARM
36CDEFINES = -DLINUX -DARM -D_REENTRANT -D_GNU_SOURCE -DSVN_REVISION=$(SVN_REVISION)
37CDEBUG = -g
38COPT = -O2
39# Once in a while, -Wformat says something useful.  The odds are against that,
40# however.
41WFORMAT = -Wno-format
42PLATFORM_H = platform-linuxarm.h
43include float_abi.mk
44
45# If the linker supports a "--hash-style=" option, use traditional
46# Sysv hash tables.  (If it doesn't support that option, assume
47# that traditional hash tables will be used by default.)
48ld_has_hash_style = $(shell $(LD) --help | grep "hash-style=")
49ifeq ($(ld_has_hash_style),)
50HASH_STYLE=
51else
52HASH_STYLE="-Wl,--hash-style=sysv"
53endif
54
55
56# Likewise, some versions of GAS may need a "-a32" flag, to force the
57
58# output file to be 32-bit compatible.
59
60A32 = $(shell ($(AS) --help -v 2>&1 | grep -q -e "-a32") && /bin/echo "-a32")
61
62.s.o:
63        $(M4) $(M4FLAGS) -I../ $< | $(AS) $(A32) $(ASFLAGS) -o $@
64.c.o:
65        $(CC) -include ../$(PLATFORM_H) -c $< $(CDEFINES) $(CDEBUG) $(COPT) -marm -march=armv7-a $(FLOAT_ABI_OPTION) $(WFORMAT)  -o $@
66
67SPOBJ = pad.o  arm-spentry.o
68ASMOBJ = arm-asmutils.o imports.o
69
70COBJ  = pmcl-kernel.o gc-common.o arm-gc.o bits.o  arm-exceptions.o \
71        image.o thread_manager.o lisp-debug.o memory.o unix-calls.o
72
73DEBUGOBJ = lispdcmd.o plprint.o plsym.o albt.o arm_print.o
74KERNELOBJ= $(COBJ) arm-asmutils.o  imports.o
75
76SPINC = lisp.s m4macros.m4 arm-constants.s arm-macros.s errors.s arm-uuo.s \
77        lisp_globals.s
78
79CHEADERS = area.h bits.h arm-constants.h lisp-errors.h gc.h lisp.h \
80        lisp-exceptions.h lisp_globals.h macros.h memprotect.h image.h \
81        threads.h arm-exceptions.h $(PLATFORM_H)
82
83# Subprims linked into the kernel ?
84# Yes:
85
86KSPOBJ = $(SPOBJ)
87all:    ../../armcl
88
89
90# No:
91
92# KSPOBJ=
93# all:  ../../armcl ../../subprims.so
94
95OSLIBS = -ldl -lm -lpthread -lrt
96
97
98../../armcl:    $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ)
99        $(CC)  $(CDEBUG)  -Wl,--export-dynamic $(HASH_STYLE) $(FLOAT_ABI_OPTION) -o $@  $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) -Wl,--no-as-needed $(OSLIBS)
100
101
102$(SPOBJ): $(SPINC)
103$(ASMOBJ): $(SPINC)
104$(COBJ): $(CHEADERS)
105$(DEBUGOBJ): $(CHEADERS) lispdcmd.h
106
107
108cclean:
109        $(RM) -f $(KERNELOBJ) $(DEBUGOBJ) ../../armcl
110
111clean:  cclean
112        $(RM) -f $(SPOBJ)
113
114strip:  ../../armcl
115        strip -g ../../armcl
Note: See TracBrowser for help on using the repository browser.