# Makefile for core VM				-*- makefile -*-
# 
#   Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors
#                              listed elsewhere in this file.
#   All rights reserved.
#   
#   This file is part of Unix Squeak.
# 
#    Permission is hereby granted, free of charge, to any person obtaining a copy
#    of this software and associated documentation files (the "Software"), to deal
#    in the Software without restriction, including without limitation the rights
#    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#    copies of the Software, and to permit persons to whom the Software is
#    furnished to do so, subject to the following conditions:
#  
#    The above copyright notice and this permission notice shall be included in
#    all copies or substantial portions of the Software.
#  
#    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#    SOFTWARE.
# 
# Author: ian.piumarta@inria.fr
# 
# Last edited: 2008-04-10 13:51:39 by piumarta on emilia.local

[make_cfg]
[make_plg]

TARGET		= vm$a
OBJS		= $(INTERP)$o sqNamedPrims$o sqVirtualMachine$o aio$o debug$o osExports$o \
		  sqUnixExternalPrims$o sqUnixMemory$o sqUnixCharConv$o sqUnixMain$o

XINCLUDES	= [includes] \
		  -I$(topdir)/platforms/Cross/plugins/FilePlugin \
		  -I$(topdir)/platforms/unix/plugins/B3DAcceleratorPlugin \
		  $(X_INCLUDES)

$(TARGET) : $(OBJS) Makefile
	$(LINK) $(TARGET) $(OBJS)
	$(RANLIB) $(TARGET)

# rebuild sqNamedPrims.o if sqNamedPrims.h changes

sqNamedPrims$o : $(srcdir)/vm/sqNamedPrims.h

# rebuild sqExtPrims (VM_LIBDIR) sqUnixMain (VM_VERSION) if config.h changes

sqUnixExternalPrims$o sqUnixMain$o : ../config.h $(topdir)/platforms/unix/vm/dlfcn-dyld.c

# GNUify the interpreter if needed

gnu-interp$o : gnu-interp.c
	$(COMPILE) $@ gnu-interp.c

gnu-interp.c : $(srcdir)/vm/interp.c
	tr '\015' '\012' < $(srcdir)/vm/interp.c > interp.c
	$(AWK) -f $(topdir)/platforms/unix/config/gnuify interp.c > $@.out
	mv $@.out $@

[make_targets]

.force :
