# Makefile for "stbasic", the Structured_BASIC-Interpreter.
#  Author: Wilfried Waetzig.
#  Author's address: waetzig@hrz.uni-kassel.de

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation (any version).

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# Directories and files
P2C = /usr/bin/p2c                 # p2c
P2CLOCAL = bas.p2crc               # local include for p2c
P2CLIB = /usr/lib/p2c              # for: libp2c.a, p2crc
SRGPLIB = /usr/local/lib/srgp      # for: libsrgp.a
SRGPINC = /usr/local/include/srgp  # for: srgp.h, srgp_phigs.h, srgppublic.h
X11LIB = /usr/X11R6/lib

# Compiler options
CC = gcc
OPT = -O2		   # optimization
DEB = # -g		   # uncomment this for debugging
DEFS =			   # place other -D types of things here
DEFC = -fpcc-struct-return
CFLAGS = $(OPT) $(DEB) $(DEFS)
LFLAGS =
LIBDIRS = -L$(P2CLIB) -L$(SRGPLIB) -L$(X11LIB)
LIBS = -lp2c -lm -lsrgp -lX11

# File names
SRCS = syscalls.c graphic.c alertbox.c filesel.c menue.c
OBJS = syscalls.o graphic.o alertbox.o filesel.o menue.o

# Making stbasic
all: stbasic.c stbasic

stbasic.c: stbasic.p
	$(P2C) -R -p100 -c $(P2CLOCAL) stbasic.p

stbasic: $(OBJS)
	$(CC) stbasic.c $(LFLAGS) $(OBJS) $(LIBDIRS) $(LIBS) -o stbasic

syscalls.o: syscalls.c
	$(CC) -c $(CFLAGS) $(DEFC) -I $(SRGPINC) syscalls.c

graphic.o: graphic.c
	$(CC) -c $(CFLAGS) $(DEFC) -I $(SRGPINC) graphic.c

alertbox.o: alertbox.c
	$(CC) -c $(CFLAGS) $(DEFC) -I $(SRGPINC) alertbox.c

filesel.o: filesel.c
	$(CC) -c $(CFLAGS) $(DEFC) -I $(SRGPINC) filesel.c

menue.o: menue.c
	$(CC) -c $(CFLAGS) $(DEFC) -I $(SRGPINC) menue.c

clean:
	rm $(OBJS) stbasic.o stbasic.c* stbasic

