#
# Makefile for "project/qplib/src"
#
# Define the position of the top-level project directory.
#
PROJECT		= ../..
#
# Define the program to be made.
#
PROGRAM		= qplib
#
# Defines for various useful project directories.  These
# shouldn't need changing.
#
BIN		= $(PROJECT)/bin
PROGBASE	= $(PROJECT)/$(PROGRAM)
SRC		= $(PROGBASE)/src
OBJ		= $(PROGBASE)/obj
#
# Defines for various processing flags.
#
QC		= $(BIN)/qc -Z
SHELL		= /bin/sh

SOURCES = \
	$(SRC)/arithmetic.ql \
	$(SRC)/call.ql \
	$(SRC)/comparison.ql \
	$(SRC)/consult.ql \
	$(SRC)/database.ql \
	$(SRC)/debug.ql \
	$(SRC)/delay.ql \
	$(SRC)/dynamic.ql \
	$(SRC)/errors.ql \
	$(SRC)/flag.ql \
	$(SRC)/freeze.ql \
	$(SRC)/interpret_term.ql \
	$(SRC)/io.ql \
	$(SRC)/ip.ql \
	$(SRC)/lib.ql \
	$(SRC)/objvar.ql \
	$(SRC)/ops.ql \
	$(SRC)/persistent.ql \
	$(SRC)/portraycl.ql \
	$(SRC)/read.ql \
	$(SRC)/signals.ql \
	$(SRC)/start.ql \
	$(SRC)/substitute.ql \
	$(SRC)/system.ql \
	$(SRC)/write.ql \
	$(SRC)/interpreter.ql
OBJECTS = \
	$(OBJ)/arithmetic.qo \
	$(OBJ)/call.qo \
	$(OBJ)/comparison.qo \
	$(OBJ)/consult.qo \
	$(OBJ)/database.qo \
	$(OBJ)/debug.qo \
	$(OBJ)/delay.qo \
	$(OBJ)/dynamic.qo \
	$(OBJ)/errors.qo \
	$(OBJ)/flag.qo \
	$(OBJ)/freeze.qo \
	$(OBJ)/interpret_term.qo \
	$(OBJ)/io.qo \
	$(OBJ)/ip.qo \
	$(OBJ)/lib.qo \
	$(OBJ)/objvar.qo \
	$(OBJ)/ops.qo \
	$(OBJ)/persistent.qo \
	$(OBJ)/portraycl.qo \
	$(OBJ)/read.qo \
	$(OBJ)/signals.qo \
	$(OBJ)/start.qo \
	$(OBJ)/substitute.qo \
	$(OBJ)/system.qo \
	$(OBJ)/write.qo \
	$(OBJ)/interpreter.qo

#
# Compile src/file.ql to obj/file.qo
#
$$(OBJ)/%.qo:: $(SRC)/%.ql
	cp $< /tmp/$*.ql
	$(QC) -o $@ -c /tmp/$*.ql
	$(RM) /tmp/$*.ql

QSSOURCES	= $(SRC)/escape.qs $(SRC)/escape_inst.qs
QSOBJECTS	= $(OBJ)/escape.qo $(OBJ)/escape_inst.qo

ALLSOURCES	= $(SOURCES) $(QSSOURCES)
ALLOBJECTS	= $(OBJECTS) $(QSOBJECTS)

#
# Compile src/file.qs to obj/file.qo
#
$(OBJ)/%.qo: $(SRC)/%.qs
	$(QC) -o $@ -c $<

compile: $(ALLOBJECTS)
	chmod 644 $(ALLOBJECTS)

$(ALLOBJECTS): $(QSSOURCES)

clean:

clobber:
	$(RM) $(ALLOBJECTS)
