#!/usr/bin/make
#
# Makefile for wapptclsh on MacOS.  Usage:
#
#    make clean wapptclsh TCLDIR=/Users/drh/local
#
# You need a static build of TCL9 in the directory that TCLDIR specifies.
# To construct such a build:
#
#    (1)  Download and untar the TCL9 sources
#    (2)  CD into the unix subdirectory
#    (3)  ./configure --disable-shared --prefix=/Users/drh/local
#                        change as appropriate -^^^^^^^^^^^^^^^^
#    (4)  make install
#

CC = gcc -O0 -framework CoreFoundation
TCLDIR ?= /Users/drh/tcl/tcl9
TCLLIB = $(TCLDIR)/lib/libtcl9.0.a -lm -lz -lpthread -ldl
TCLINC = $(TCLDIR)/include
TCLSH = $(TCLDIR)/bin/tclsh9.0

all: wapptclsh

wapptclsh: wapptclsh.c
	$(CC) -I. -I$(TCLINC) -o $@ wapptclsh.c $(TCLLIB)

wapptclsh.c:	wapptclsh.c.in wapp.tcl wapptclsh.tcl tclsqlite3.c mkccode.tcl
	$(TCLSH) mkccode.tcl wapptclsh.c.in >$@

clean:	
	rm -f wapptclsh wapptclsh.c
