2 # Variables included by all Makefiles.
5 ## Directory definitions
7 libdir = $(slateroot
)/lib
8 mobiusdir
= $(slateroot
)/src
/mobius
9 pluginsdir
= $(slateroot
)/src
/plugins
10 testdir
= $(slateroot
)/tests
13 datadir = $(prefix)/share
/slate
14 exec_prefix = $(prefix)/bin
16 includedir = $(prefix)/include
17 mandir = $(prefix)/share
/man
18 man1dir = $(mandir)/man1
19 infodir = $(prefix)/info
20 lispdir
= $(prefix)/share
/emacs
/site-lisp
23 ## Build modes. Set on command line using QUIET=1, DEBUG=1 or PROFILE=1
32 SILENT_ERRORS
:= 2> $(DEVNULL
)
33 LIBTOOL_FLAGS
+= --silent
39 CFLAGS
+= -DSLATE_BUILD_TYPE
="\"Debug\""
43 COPTFLAGS
+= -pg
-g
-O2
44 CFLAGS
+= -DSLATE_BUILD_TYPE
="\"Profile\""
47 CFLAGS
+= -DSLATE_BUILD_TYPE
="\"Optimized\""
55 ## All required executables
62 WGET
:= wget
-q
--cache
=off
70 ## Platform independent definitions
73 CFLAGS
+= -DSLATE_DATADIR
=$(datadir) -D_POSIX_SOURCE
=200112L -D_POSIX_C_SOURCE
=200112L
74 CFLAGS
+= $(COPTFLAGS
) -Wall
-Wno-unknown-pragmas
-pthread
$(PRINT_DEBUG
) $(EXTRACFLAGS
) $(INCLUDES
)
75 # include -pedantic later fixme
78 ## Determine the host system's byte order.
79 ## This creates a temporary test executable in the $(slateroot) directory
80 ## since we can guarantee write permissions there on all platforms.
82 BYTE_ORDER
:= "int main(){union{long l;char c[sizeof(long)];}u;u.l=1;return(u.c[sizeof(long)-1]==1);}"
83 BYTE_ORDER
:= $(shell echo
$(BYTE_ORDER
) > $(slateroot
)/byteorder.c
)
84 BYTE_ORDER
:= $(shell $(CC
) -o
$(slateroot
)/byteorder
$(slateroot
)/byteorder.c
)
85 BYTE_ORDER
:= $(shell $(slateroot
)/byteorder
; echo
$$?
)
86 BYTE_ORDER_
:= $(shell $(RM
) $(slateroot
)/byteorder.
* $(slateroot
)/byteorder
1>&2)
87 ifeq ($(BYTE_ORDER
),0)
88 BYTE_ORDER
:= LITTLE_ENDIAN
89 BYTE_ORDER_PREFIX
:= little
91 BYTE_ORDER
:= BIG_ENDIAN
92 BYTE_ORDER_PREFIX
:= big
98 CCVERSION
:= $(shell $(CC
) -dumpversion
)
100 LDFLAGS
:= # -avoid-version
102 #PLUGINS := platform.so posix.so pipe.so
103 #PLUGINS := x-windows.so
105 HOST_SYSTEM
:= $(shell uname
-s
)
107 INSTALL_MODE
:= -m
644
108 CPU_TYPE
:= `uname -m`
109 VM_LIBRARIES
= -lm
-ldl
-lpthread
113 VMDIR
:= $(slateroot
)/src
/vm
114 VM
:= $(VMDIR
)/$(VMNAME
)
115 DEFAULT_IMAGE ?
= slate.image
116 KERNEL_IMAGES
:= kernel.new.
*.
$(WORD_SIZE
).
*.image
117 DEFAULT_KERNEL_IMAGE ?
= $(shell ls
-t
$(KERNEL_IMAGES
) | head
-1)
119 CFLAGS_x-windows.c
=`pkg-config --cflags x11` `pkg-config --cflags cairo` -Werror
120 LDFLAGS_x-windows.lo
=`pkg-config --libs x11` `pkg-config --libs cairo`
121 CFLAGS_cocoa-windows.c
=`pkg-config --cflags cocoa` `pkg-config --cflags cairo`
122 LDFLAGS_cocoa-windows.lo
=`pkg-config --libs cocoa` `pkg-config --libs cairo`
123 CFLAGS_glib-wrapper.c
=`pkg-config --cflags glib-2.0`
124 LDFLAGS_glib-wrapper.lo
=`pkg-config --libs glib-2.0` `pkg-config --libs gobject-2.0`
125 CFLAGS_gdk-wrapper.c
=`pkg-config --cflags gdk-2.0`
126 LDFLAGS_gdk-wrapper.lo
=`pkg-config --libs gdk-2.0` `pkg-config --libs gthread-2.0`
127 CFLAGS_gtk-wrapper.c
=`pkg-config --cflags gtk+-2.0`
128 LDFLAGS_gtk-wrapper.lo
=`pkg-config --libs gtk+-2.0`
129 CFLAGS_llvm-wrapper.c
=`llvm-config --cflags`
130 LDFLAGS_llvm-wrapper.lo
=
134 PRINT_DEBUG_G
=-DPRINT_DEBUG_DEFUN
-DPRINT_DEBUG_GC_1
-DPRINT_DEBUG_OPCODES
135 PRINT_DEBUG_Y
= -DPRINT_DEBUG_STACK_POINTER
-DPRINT_DEBUG_STACK_PUSH
-DPRINT_DEBUG_FOUND_ROLE
-DPRINT_DEBUG_FUNCALL
136 PRINT_DEBUG_X
=-DPRINT_DEBUG
-DPRINT_DEBUG_OPCODES
-DPRINT_DEBUG_INSTRUCTION_COUNT
-DPRINT_DEBUG_CODE_POINTER
-DPRINT_DEBUG_DISPATCH
137 PRINT_DEBUG_1
=-DPRINT_DEBUG_DEFUN
-DPRINT_DEBUG_GC_1
138 PRINT_DEBUG_4
=-DPRINT_DEBUG_DEFUN
-DPRINT_DEBUG_GC
-DPRINT_DEBUG_OPCODES
-DPRINT_DEBUG_CODE_POINTER
-DPRINT_DEBUG_ENSURE
-DPRINT_DEBUG_STACK
139 PRINT_DEBUG_3
=-DPRINT_DEBUG_DEFUN
-DPRINT_DEBUG_GC
-DPRINT_DEBUG_OPTIMIZER
-DPRINT_DEBUG_PIC_HITS
-DPRINT_DEBUG_UNOPTIMIZER
140 PRINT_DEBUG_2
=-DPRINT_DEBUG_DEFUN
-DPRINT_DEBUG
-DPRINT_DEBUG_OPCODES
-DPRINT_DEBUG_INSTRUCTION_COUNT
-DPRINT_DEBUG_CODE_POINTER
-DPRINT_DEBUG_DISPATCH
-DPRINT_DEBUG_GC_MARKINGS
141 PRINT_DEBUG
=$(PRINT_DEBUG_1
)
144 ## Determine CPU type
146 #ifeq ($(HOST_SYSTEM), Darwin)
147 # CPU_TYPE := powerpc
150 ## TODO: Sparc detection for SunOS?
151 ## TODO: Base CPU type on real information, not just generic OS variant
153 ## CPU-type specific overrides. Any of the variables above may be changed here.
160 CFLAGS
+= -DVERSION
="\"$(VERSION)\""
163 CFLAGS
+=-DSLATE_DEFAULT_IMAGE
=$(DEFAULT_IMAGE
)
166 CFLAGS
+= -m
$(WORD_SIZE
)
168 #ifeq ($(CPU_TYPE), i686)
169 # CFLAGS += -m$(WORD_SIZE)
172 #ifeq ($(CPU_TYPE), x86_64)
173 # CFLAGS += -m$(WORD_SIZE)
176 ## Platform specific overrides. Any of the variables above may be changed here.
178 ifeq ($(HOST_SYSTEM
), AIX
)
180 PLUGINS
:= platform.so posix.so pipe.so
183 ifeq ($(HOST_SYSTEM
), BeOS
)
187 ifeq ($(findstring CYGWIN
,$(HOST_SYSTEM
)), CYGWIN
)
189 LDFLAGS
+= -no-undefined
192 # DEVNULL := NUL # Required if using cmd.exe and not bash.
195 ifeq ($(HOST_SYSTEM
), Darwin
)
196 # LIBTOOL := MACOSX_DEPLOYMENT_TARGET=10.3 glibtool
198 PLUGINS
:= cocoa-windows.so
201 ifeq ($(HOST_SYSTEM
), DragonFly
)
205 ifeq ($(HOST_SYSTEM
), FreeBSD
)
210 ifeq ($(HOST_SYSTEM
), HP-UX
)
213 PLUGINS
:= platform.so posix.so pipe.so
216 ifeq ($(HOST_SYSTEM
), Linux
)
218 PLUGINS
+= gtk-wrapper.so gdk-wrapper.so glib-wrapper.so llvm-wrapper.so x-windows.so
221 ifeq ($(findstring MINGW
,$(HOST_SYSTEM
)), MINGW
)
226 ifeq ($(HOST_SYSTEM
), NetBSD
)
230 ifeq ($(HOST_SYSTEM
), SunOS
)
231 PLUGINS
:= platform.so posix.so pipe.so
232 # Work around GCC Ultra SPARC alignment bug
233 # TODO: Should be CPU specific.
234 COPTFLAGS
:= $(subst -O2
,-O0
, $(COPTFLAGS
))
237 PLUGINS
:= $(subst .so
,$(LIB_SO_EXT
), $(PLUGINS
))