Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f7aa9abd39
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 149 lines (107 sloc) 5.242 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
# Copyright 2010, The Native Client SDK Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.

# Heavily edited by Yoshiki Ohshima (yoshiki at vpri.org) for the
# Squeak VM There are a few complications as the sources are
# distributed a few different places and making vm plugins depends on
# some what files located far away.

# You can change the macro INTERP not to gnuify

.PHONY: all clean

PYTHON = python

SQCFILES = squeak.c sqUnixMain.c sqNaClWindow.c sqNaClSound.c sqNaClFile.c sqUnixMemory.c sqUnixExternalPrims.c osExports.c
CROSSCFILES = sqVirtualMachine.c sqNamedPrims.c
CFILES = Etoys.c
#INTERP = interp.c
INTERP = gnu-interp.c

NACL_SDK_ROOT = ../..

# common.mk has rules to build .o files from .cc files.
-include ../common.mk

OPT_FLAGS = -O2 -fomit-frame-pointer

AR = $(NACL_SDK_ROOT)/$(NACL_TOOLCHAIN_DIR)/bin/nacl-ar
RANLIB = $(NACL_SDK_ROOT)/$(NACL_TOOLCHAIN_DIR)/bin/nacl-ranlib

CFLAGS = -Wall -Wno-long-long -pthread -Werror
SQCFLAGS = -Wno-long-long -pthread -Wno-pragmas -DNO_STD_FILE_SUPPORT -DEMBEDDED_IMAGE_FILE
INCLUDES = -Isrc/vm -I. -Ivm -ICross/vm
LDFLAGS = -lppruntime \
          -lpthread \
          -lplatform \
          -lgio \
          -lsrpc \
          $(ARCH_FLAGS)

X8632 = _x86_32
X8664 = _x86_64

INTERP_X86_32 = $(addprefix bld/,$(subst .c,$(X8632).o, $(INTERP)))
VM_SQ_OBJECTS_X86_32 = $(addprefix bld/,$(subst .c,$(X8632).o,$(notdir $(SQCFILES))))
VM_CROSS_OBJECTS_X86_32 = $(addprefix bld/,$(subst .c,$(X8632).o,$(notdir $(CROSSCFILES))))
PLUGINS_X86_32 = $(addprefix bld/,$(addsuffix $(X8632).a,$(notdir $(wildcard src/vm/intplugins/*))))

INTERP_X86_64 = $(addprefix bld/,$(subst .c,$(X8664).o, $(INTERP)))
VM_SQ_OBJECTS_X86_64 = $(addprefix bld/,$(subst .c,$(X8664).o,$(notdir $(SQCFILES))))
VM_CROSS_OBJECTS_X86_64 = $(addprefix bld/,$(subst .c,$(X8664).o,$(notdir $(CROSSCFILES))))
PLUGINS_X86_64 = $(addprefix bld/,$(addsuffix $(X8664).a,$(notdir $(wildcard src/vm/intplugins/*))))

all: t32 t64

t32: squeak$(X8632).nexe
t64: squeak$(X8664).nexe
# check_variables #squeak.nmf squeak_dbg.nmf

bld/interp.c: src/vm/interp.c
cp $@ $<

bld/gnu-interp.c: src/vm/interp.c
awk -v RS="\r\n" -f gnuify $< > $@
# awk -f gnuify $< > $@

# Intermediate Targets for 32 bit

$(INTERP_X86_32): bld/$(INTERP)
$(CC) $(SQCFLAGS) -m32 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<

$(VM_SQ_OBJECTS_X86_32):
$(CC) $(SQCFLAGS) -m32 $(INCLUDES) $(OPT_FLAGS) -c -o $@ vm/$(subst $(X8632).o,,$(notdir $@)).c

$(VM_CROSS_OBJECTS_X86_32):
$(CC) $(SQCFLAGS) -m32 $(INCLUDES) $(OPT_FLAGS) -c -o $@ Cross/vm/$(subst $(X8632).o,,$(notdir $@)).c

$(PLUGINS_X86_32): bld/%_x86_32.a: src/vm/intplugins/%
$(AR) rc $@
for i in $^/$(notdir $^).c $(wildcard plugins/$(notdir $^)/*.c) $(wildcard vm/plugins/$(notdir $^)/*.c); do \
$(CC) $(SQCFLAGS) -m32 $(INCLUDES) -DSQUEAK_BUILTIN_PLUGIN -Iplugins/$(notdir $^) $(OPT_FLAGS) -c -o bld/`basename $$i .c`$(X8632).o $$i; \
$(AR) r $@ bld/`basename $$i .c`$(X8632).o; \
done
$(RANLIB) $@

# Intermediate Targets for 64 bit

$(INTERP_X86_64): bld/$(INTERP)
$(CC) $(SQCFLAGS) -m64 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<

$(VM_SQ_OBJECTS_X86_64):
$(CC) $(SQCFLAGS) -m64 $(INCLUDES) $(OPT_FLAGS) -c -o $@ vm/$(subst $(X8664).o,,$(notdir $@)).c

$(VM_CROSS_OBJECTS_X86_64):
$(CC) $(SQCFLAGS) -m64 $(INCLUDES) $(OPT_FLAGS) -c -o $@ Cross/vm/$(subst $(X8664).o,,$(notdir $@)).c

$(PLUGINS_X86_64): bld/%_x86_64.a: src/vm/intplugins/%
$(AR) rc $@
for i in $^/$(notdir $^).c $(wildcard plugins/$(notdir $^)/*.c) $(wildcard vm/plugins/$(notdir $^)/*.c); do \
$(CC) $(SQCFLAGS) -m64 $(INCLUDES) -DSQUEAK_BUILTIN_PLUGIN -Iplugins/$(notdir $^) $(OPT_FLAGS) -c -o bld/`basename $$i .c`$(X8664).o $$i; \
$(AR) r $@ bld/`basename $$i .c`$(X8664).o; \
done
$(RANLIB) $@

# Have to link with g++: the implementation of the PPAPI proxy
# is a C++ implementation

squeak$(X8632).nexe: $(OBJECTS_X86_32) $(VM_SQ_OBJECTS_X86_32) $(VM_CROSS_OBJECTS_X86_32) $(INTERP_X86_32) $(PLUGINS_X86_32)
$(CPP) $^ $(LDFLAGS) -m32 -o $@

squeak$(X8664).nexe: $(OBJECTS_X86_64) $(VM_SQ_OBJECTS_X86_64) $(VM_CROSS_OBJECTS_X86_64) $(INTERP_X86_64) $(PLUGINS_X86_64)
$(CPP) $^ $(LDFLAGS) -m64 -o $@

squeak_x86_32_dbg.nexe: $(OBJECTS_X86_32_DBG)
$(CPP) $^ $(LDFLAGS) -m32 -o $@

squeak_x86_64_dbg.nexe: $(OBJECTS_X86_64_DBG)
$(CPP) $^ $(LDFLAGS) -m64 -o $@

squeak.nmf: squeak$(X8632).nexe squeak$(X8664).nexe
@echo "Creating squeak.nmf..."
$(PYTHON) ../generate_nmf.py --nmf $@ \
--x86-64 squeak$(X8664).nexe --x86-32 squeak$(X8632).nexe

squeak_dbg.nmf: squeak_x86_32_dbg.nexe squeak_x86_64_dbg.nexe
@echo "Creating squeak_dbg.nmf..."
$(PYTHON) ../generate_nmf.py --nmf $@ \
--x86-64 squeak_x86_64_dbg.nexe \
--x86-32 squeak_x86_32_dbg.nexe

clean:
-$(RM) *.o *.obj *.nexe bld/* interp.c gnu-interp.c

# Some debug targets

echo:
@echo VM_SQ_OBJECTS_X86_32 is $(VM_SQ_OBJECTS_X86_32)
@echo VM_CROSS_OBJECTS_X86_32 is $(VM_CROSS_OBJECTS_X86_32)
@echo PLUGINS_X86_32 is $(PLUGINS_X86_32)

plugins: $(PLUGINS_X86_32)
vm: $(VM_SQ_OBJECTS_X86_32) $(VM_CROSS_OBJECTS_X86_32)

Etoys.c:

# On the host environment, compile mkimage.c and then execute it with your faviorite Squeak image to produce Etoys.c

Something went wrong with that request. Please try again.