### AZ-Prolog Interpreter Makefile For Linux

CC =gcc

AZProlog = /usr/local

PDIR =   $(AZProlog)/share/azprolog/system/pl
CDIR =   $(AZProlog)/share/azprolog/system/C

AZLIB = $(AZProlog)/lib/libazp.a

BASE_BLTN_C= $(CDIR)/mytime.c $(CDIR)/az_syslog.c

BASE_BLTNPL = $(PDIR)/mlt_parent.pl $(PDIR)/setof.pl $(PDIR)/utility.pl $(PDIR)/iso_pred.pl

CURSES_BLTNPL = $(BASE_BLTNPL) $(PDIR)/manual.pl
CGI_BLTNPL    = $(PDIR)/prologcgi.pl $(BASE_BLTNPL)
CHILD_BLTNPL  = $(BASE_BLTNPL) $(PDIR)/mlt_child.pl $(PDIR)/manual.pl 

PCCOPT = -Wall -O4
AZPCFLAGS  = /message /s_verbos /cc $(CC) /ccopt "$(PCCOPT)"

### When you want to use static azprolog-library 
# AZPCFLAGS  = /message /s_verbos /cc $(CC) /static /ccopt "$(PCCOPT)"

###############
system : prolog prolog_c prologcgi

prolog : $(CURSES_BLTNPL) $(AZLIB) $(BASE_BLTN_C) 
	azpc -p $(BASE_BLTN_C) $(CURSES_BLTNPL) /i $(AZPCFLAGS)
	strip --remove-section=.comment --remove-section=.note $@

prolog_c : $(CHILD_BLTNPL) $(AZLIB) $(BASE_BLTN_C)
	azpc -p $(BASE_BLTN_C) $(CHILD_BLTNPL) /i $(AZPCFLAGS) /dcurses /e prolog_c
	strip --remove-section=.comment --remove-section=.note $@

prologcgi : $(CGI_BLTNPL) $(AZLIB) $(BASE_BLTN_C)
	azpc -p $(CGI_BLTNPL)  $(BASE_BLTN_C) /i $(AZPCFLAGS) /dcurses /e prologcgi /no
	strip --remove-section=.comment --remove-section=.note $@

###############
clean :
	rm -f mkaz *.[co]
	rm -f prolog prolog_c prologcgi
	rm -f *~ .*~
