source: trunk/source/lisp-kernel/win32/Makefile @ 10994

Last change on this file since 10994 was 10994, checked in by gb, 11 years ago

Build the kernel by invoking the linker directly, so that we have
some control over order of object files. Don't use pei-ia32.x as
a linker script; instead, rely on the fact that x86-spjump32 is
loaded first and that it reserves space for the static area.

After all of the fuss and bogosity about letting the address of
NIL vary on a per-platform basis, wind up putting NIL at the same
address it is on other x8632 platforms. (The problems had to do
with the fact that zero_bits() was clobbering malloc data structures,
not with where the kernel loaded in memory.)

File size: 3.4 KB
Line 
1#
2#   Copyright (C) 2008 Clozure Associates
3#   This file is part of OpenMCL. 
4#
5#   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
6#   License , known as the LLGPL and distributed with OpenMCL as the
7#   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8#   which is distributed with OpenMCL as the file "LGPL".  Where these
9#   conflict, the preamble takes precedence. 
10#
11#   OpenMCL 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
16
17VPATH = ../
18RM = /bin/rm
19CC = gcc
20AS = as
21M4 = m4
22LD = ld
23ASFLAGS = -g --32
24M4FLAGS = -DWIN_32 -DWINDOWS -DX86 -DX8632 -DWIN32_ES_HACK
25CDEFINES = -DWIN_32 -DWINDOWS -D_REENTRANT -DX86 -DX8632 -D_GNU_SOURCE  -D__MSVCRT__ -D__MSVCRT_VERSION__=0x700 -D_WIN32_WINNT=0x0502 -DWIN32_ES_HACK
26CDEBUG = -g
27COPT = #-O2
28
29# If the linker supports a "--hash-style=" option, use traditional
30# SysV hash tables.  (If it doesn't support that option, assume
31# that traditional hash tables will be used by default.)
32ld_has_hash_style = $(shell $(LD) --help | grep "hash-style=")
33ifeq ($(ld_has_hash_style),)
34HASH_STYLE=
35else
36HASH_STYLE="-Wl,--hash-style=sysv"
37endif
38
39# There may be some confusion about whether or not C symbols have
40# leading underscores or not.  The assembler sources seem to
41# expect them to and mingw import libs seem to use them, but
42# it's not clear whether or not native win64 libraries use this
43# convention (and I'm not sure whether the Cygwin-hosted win64
44# toolchain behaves the same way as when hosted on Linux ...
45# The compiler default seems to be to use them; if we want to
46# suppress their use, uncomment the following:
47
48SUPPRESS_UNDERSCORES=#-fno-leading-underscore
49
50.s.o:
51        $(M4) $(M4FLAGS) -I../ $< | $(AS)  $(ASFLAGS) -o $@
52.c.o:
53        $(CC) -c $< $(CDEFINES) $(CDEBUG) $(COPT) ${SUPPRESS_UNDERSCORES} -mno-cygwin -o $@
54
55# order matters: x86-spjump32.o must be first.
56SPOBJ = x86-spjump32.o x86-spentry32.o x86-subprims32.o
57ASMOBJ = x86-asmutils32.o imports.o
58
59COBJ  = pmcl-kernel.o gc-common.o x86-gc.o bits.o  x86-exceptions.o \
60        image.o thread_manager.o lisp-debug.o memory.o windows-calls.o
61
62DEBUGOBJ = lispdcmd.o plprint.o plsym.o xlbt.o x86_print.o
63KERNELOBJ= $(COBJ) x86-asmutils32.o  imports.o
64
65SPINC = lisp.s m4macros.m4 x86-constants.s x86-macros.s errors.s x86-uuo.s \
66        x86-constants32.s
67
68CHEADERS = area.h bits.h x86-constants.h lisp-errors.h gc.h lisp.h \
69        lisp-exceptions.h lisp_globals.h macros.h memprotect.h image.h \
70        Threads.h x86-constants32.h x86-exceptions.h lisptypes.h
71
72
73KSPOBJ = $(SPOBJ)
74all:    ../../wx86cl.exe
75
76# Order matters: libs that provide definitions must follow libs that
77# reference them.  (It's legal to use -lfoo multiple times to try to
78# work around this.)
79OSLIBS = /usr/i686-pc-mingw32/lib/crt2.o -L/usr/lib/w32api \
80        -L/usr/i686-pc-mingw32/lib  -lm -lpsapi -lws2_32  \
81        -lmingw32 -lmoldname -lmingwex -lmsvcrt -lkernel32
82LIBGCC = $(shell gcc -mno-cygwin -print-libgcc-file-name)
83IMAGE_BASE =--image-base=0x10000
84
85../../wx86cl.exe: $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) Makefile
86        ld -o ../../wx86cl.exe  $(IMAGE_BASE) \
87        $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) $(OSLIBS) $(LIBGCC)
88
89
90
91$(SPOBJ): $(SPINC)
92$(ASMOBJ): $(SPINC)
93$(COBJ): $(CHEADERS)
94$(DEBUGOBJ): $(CHEADERS) lispdcmd.h
95
96
97cclean:
98        $(RM) -f $(KERNELOBJ) $(DEBUGOBJ) ../../wx86cl.exe
99
100clean:  cclean
101        $(RM) -f $(SPOBJ)
102
103strip:  ../../wx86cl.exe
104        strip -g ../../wx86cl.exe
Note: See TracBrowser for help on using the repository browser.