# User configuration for this example: change default language and script
# file name; these can be overriden runtime from the command line
# Prefix is where fungw is installed
PREFIX=/usr/local/lib
SCLANG=fawk
SCRIPT_FN=../00_hello/hello.fawk
#CFLAGS_DBG = -g -Wall


FUNGW=$(PREFIX)/fungw

# You have to have genht installed too
LDFLAGS_FUNGW=-lfungw -ldl -lgenht

# this is how language and script file name is passed in for the example code
# so it doesn't need to do any parsing or run-time decision
CFLAGS_LANG = \
	-DSCLANG=$(SCLANG) \
	-DSCLANG_STR=\"$(SCLANG)\" \
	-DSCRIPT_FN=\"$(SCRIPT_FN)\" \
	-DPREFIX=\"$(PREFIX)\"

all: hello

hello: hello.o
	$(CC) -o hello hello.o $(LDFLAGS) $(LDFLAGS_SCRIPT) $(LDFLAGS_FUNGW) -lm $(LDLIBS)

hello.o: hello.c Makefile
	$(CC) -c $(CFLAGS) $(CFLAGS_LANG) $(CFLAGS_SCRIPT) $(CFLAGS_DBG) -o hello.o hello.c

clean:
	-rm hello hello.o 2>/dev/null
