source: trunk/source/lisp-kernel/androidarm/Makefile @ 15205

Last change on this file since 15205 was 15205, checked in by gb, 9 years ago

Include the (Apache-licensed) android_native_app_glue stuff and
hook it into the kernel; add some dependent Android libraries.

In arm-spentry.s, use ".globl" instead of ".global", since the
World's Most Advanced Assembler doesn't understand the latter.
(Not that we currently care.)

File size: 3.7 KB
Line 
1#
2#   Copyright (C) 2010 Clozure Associates
3#   This file is part of Clozure CL. 
4#
5#   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
6#   License , known as the LLGPL and distributed with Clozure CL as the
7#   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8#   which is distributed with Clozure CL as the file "LGPL".  Where these
9#   conflict, the preamble takes precedence. 
10#
11#   Clozure CL is referenced in the preamble as the "LIBRARY."
12#
13#   The LLGPL is also available online at
14#   http://opensource.franz.com/preamble.html
15
16LIBBASE = 0x04001000
17NDK = /usr/local/android-ndk-r7
18HOST = darwin-x86
19ANDROIDVERSION = android-9
20SYSROOT = $(NDK)/platforms/$(ANDROIDVERSION)/arch-arm
21NDKLIB = $(SYSROOT)/usr/lib
22NDKINC = $(SYSROOT)/usr/include
23ABI = arm-linux-androideabi
24NDKBIN = $(NDK)/toolchains/$(ABI)-4.4.3/prebuilt/$(HOST)/bin/$(ABI)-
25VPATH = ../
26RM = /bin/rm
27AS = $(NDKBIN)as
28CC = $(NDKBIN)gcc --sysroot $(SYSROOT)
29LD = $(NDKBIN)ld
30HOSTCC = cc -m32
31M4 = m4
32ASFLAGS = -mfpu=vfp
33M4FLAGS = -DLINUX -DARM -DANDROID -DLIBBASE=$(LIBBASE)
34CDEFINES = -DLINUX -DARM -DANDROID -D_REENTRANT -D_GNU_SOURCE -DUSE_FUTEX -DCCLSHARED
35CDEBUG = -g
36COPT = #-O2
37# Once in a while, -Wformat says something useful.  The odds are against that,
38# however.
39WFORMAT = -Wno-format
40PLATFORM_H = platform-androidarm.h
41
42# If the linker supports a "--hash-style=" option, use traditional
43# Sysv hash tables.  (If it doesn't support that option, assume
44# that traditional hash tables will be used by default.)
45ld_has_hash_style = $(shell $(LD) --help | grep "hash-style=")
46ifeq ($(ld_has_hash_style),)
47HASH_STYLE=
48else
49HASH_STYLE="-Wl,--hash-style=sysv"
50endif
51
52
53
54.s.o:
55        $(M4) $(M4FLAGS) -I../ $< | $(AS) $(ASFLAGS) -o $@
56.c.o:
57        $(CC) -include ../$(PLATFORM_H) -I. -I$(NDKINC) -c $<  $(CDEFINES) $(CDEBUG) $(COPT) $(WFORMAT) -fpic -o $@
58
59
60# -nostdinc -isystem ${NDK}/usr/gcc-include -isystem $(NDK)/usr/include
61SPOBJ = pad.o  arm-spentry.o
62#arm-subprims.o
63ASMOBJ = arm-asmutils.o imports.o
64
65COBJ  = pmcl-kernel.o gc-common.o arm-gc.o bits.o  arm-exceptions.o \
66        image.o thread_manager.o lisp-debug.o memory.o unix-calls.o \
67        android_native_app_glue.o
68
69DEBUGOBJ = lispdcmd.o plprint.o plsym.o albt.o arm_print.o
70KERNELOBJ= $(COBJ) arm-asmutils.o  imports.o
71
72SPINC = lisp.s m4macros.m4 arm-constants.s arm-macros.s errors.s arm-uuo.s \
73        lisp_globals.s
74
75CHEADERS = area.h bits.h arm-constants.h lisp-errors.h gc.h lisp.h \
76        lisp-exceptions.h lisp_globals.h macros.h memprotect.h image.h \
77        threads.h arm-exceptions.h $(PLATFORM_H)
78
79# Subprims linked into the kernel ?
80# Yes:
81
82KSPOBJ = $(SPOBJ)
83all:    ../../libaarmcl.so ../../aarmcl
84
85aarmcl.o: aarmcl.c
86        $(CC) -g -I$(NDKINC) -c $< -fpic -o $@
87
88
89OSLIBS = -ldl -lm -lc -landroid -llog
90APPLIBS = $(OSLIBS) $(NDKLIB)/crtbegin_dynamic.o $(NDKLIB)/crtend_android.o
91
92
93../../libaarmcl.so:     $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) ./armandroid.x ./fixlib
94        $(LD) --shared -Bdynamic -dynamic-linker /system/bin/linker -nostdlib -z nocopyreloc  -o ../../libaarmcl.so  -L $(NDKLIB) pad.o arm-spentry.o  pmcl-kernel.o gc-common.o arm-gc.o bits.o arm-exceptions.o image.o thread_manager.o lisp-debug.o memory.o unix-calls.o arm-asmutils.o imports.o lispdcmd.o plprint.o plsym.o albt.o arm_print.o android_native_app_glue.o --no-as-needed $(OSLIBS) -T ./armandroid.x
95        ./fixlib $(LIBBASE) >> ../../libaarmcl.so
96
97../../aarmcl:   aarmcl.o
98                $(LD) -Bdynamic -e _start  -dynamic-linker /system/bin/linker -nostdlib -z nocopyreloc  -o ../../aarmcl -L $(NDKLIB) aarmcl.o $(APPLIBS)
99
100./fixlib: ./fixlib.c
101        $(HOSTCC) -g $< -o $@
102
103$(SPOBJ): $(SPINC)
104$(ASMOBJ): $(SPINC)
105$(COBJ): $(CHEADERS)
106$(DEBUGOBJ): $(CHEADERS) lispdcmd.h
107
108
109cclean:
110        $(RM) -f $(KERNELOBJ) $(DEBUGOBJ) ../../aarmcl ../../libaarmcl.so ./fixlib
111
112clean:  cclean
113        $(RM) -f $(SPOBJ)
114
Note: See TracBrowser for help on using the repository browser.