# NOTE: If you are not using the fancy CMU version of make that looks
# at Makeconf, uncomment one the the following.

# Enable all the speed hacks:
# DEFINES = -DFAST
# CFLAGS = -O

# Enable some hopefully unnecessary checks:
# DEFINES =
# CFLAGS = -g

# Disable the method cache:
# DEFINES = -DFAST -DNO_METH_CACHE
# CFLAGS = -O

all: emulator

OBJF1 = emulator.o mymalloc.o worldio.o gc.o stacks.o weak.o 
OBJF2 = signal.o $(EXTRAS)
OBJFILES = $(OBJF1) $(OBJF2)
INCLUDES = emulator.h config.h stacks.h gc.h
MISC = Makefile instruction-table.oak

CFILES = $(OBJFILES:.o=.c)

Proto.h: $(CFILES) $(INCLUDES)
	/usr/misc/.case/bin/mkptypes -e -A -x $(CFILES) > Proto.h

signal.o: config.h
$(OBJF1): config.h emulator.h Proto.h
emulator.o gc.o stacks.o: stacks.h
gc.o weak.o: gc.h

.c.o: ; $(CC) $(CFLAGS) $(DEFINES) -c $*.c

emulator: $(OBJFILES)
	$(CC) $(CFLAGS) $(LDCFLAGS) -o $@ $(OBJFILES)

.linted: $(CFILES) $(INCLUDES)
	lint -b $(DEFINES) $(CFILES)
	touch .linted

release:
	copy ../../fast/makefile		../../../$(RELEASEDIR)/src/fast
	copy ../../safe/makefile		../../../$(RELEASEDIR)/src/safe
	copy ../../Makeconf			../../../$(RELEASEDIR)/src
	copy ../../src/*.[ch]			../../../$(RELEASEDIR)/src/src
	copy ../../src/Makefile			../../../$(RELEASEDIR)/src/src
	copy ../../src/instruction-table.oak	../../../$(RELEASEDIR)/src/src
#	copy $(CFILES) $(INCLUDES) $(MISC)	../../../$(RELEASEDIR)/src/src
