# 
# configurable options
#  - set DEBUG = 1 to turn on debugging support
#
DEBUG = 0
PROJ_NAME = boa
INSTALL_DIR = 
PROGS := $(PROJ_NAME).exe
CFLAGS +=

#
# You should not need to modify anything beyond this point
#

TOPDIR = ..
include $(TOPDIR)/Rules.mak

ifeq '$(DEBUG)' '1'
	PROGS += $(PROGS:.exe=.gdb)
	CFLAGS += -DDEBUG
endif

FLTFLAGS := -s 8192
OBJS = alias.o auth.o boa.o cgi.o cgi_header.o config.o get.o hash.o \
	log.o md5.o nls.o pipe.o queue.o read.o request.o response.o signals.o \
	timestamp.o util.o y.tab.o lex.yy.o 

YACC = bison -y 
LEX = flex 

ifdef BUILD_NETtel
CFLAGS += -DCONFIG_NETtel 
endif
ifdef BUILD_NETtel1500
CFLAGS += -DCONFIG_NETtel
endif

CFLAGS += -DNO_DAEMON -DEMBED
LDLIBS +=-lcrypt
#SSL_LIBS = 

#ifdef CONFIG_USER_BOA_WITH_SSL
CFLAGS += $(INCSSL) -DSERVER_SSL=1 
LDLIBS += -lssl -lcrypto
#SSL_LIBS += $(LIBSSL) $(LIBCRYPTO)
#endif

all: $(PROGS)

$(PROJ_NAME).bin: $(OBJS)

y.tab.c y.tab.h:	boa_grammar.y
	$(YACC) -d boa_grammar.y

lex.yy.c:	boa_lexer.l
	$(LEX) boa_lexer.l

.PHONY: clean
clean:
	-rm -f *.[oad] *.elf *.gdb *.bin *.exe

.PHONY: install
install: all
ifeq "$(INSTALL_DIR)" ""
	$(error No installation directory specified)
endif
	mkdir -p $(INSTALL_DIR)/sbin
	install -v $(filter %.exe, $(PROGS)) $(INSTALL_DIR)/sbin

