#  This is the makefile for edbrowse under BSD Unix.

#  Flags for compilation.
#  I know - I set the Linux flag here, but it seems to work.
CFLAGS = -I/usr/local/include -I/usr/local/include/js -DSYSBSD -DXP_UNIX

#  Tell the dynamic linker to look in the pkg area.
LFLAGS = -s -Wl,--rpath -Wl,/usr/pkg/lib

#  Libraries for edbrowse.
LIBS = -L /usr/local/lib -lpcre -lm -lssl -ljs -lcrypto -lpthread -lcurl

#  Make the dynamically linked executable program by default.
#  Edbrowse executable.
all: edbrowse

#  edbrowse objects
EBOBJS = main.o buffers.o url.o auth.o http.o sendmail.o fetchmail.o \
	html.o format.o cookies.o stringfile.o jsdom.o jsloc.o messages.o

#  Header file dependencies.
$(EBOBJS) : eb.h eb.p messages.h
main.o tcp.o http.o sendmail.o: tcp.h

edbrowse: $(EBOBJS) tcp.o dbstubs.o
	cc $(LFLAGS) -o edbrowse tcp.o dbstubs.o $(EBOBJS) $(LIBS)

#  Build function prototypes.
proto:
	mkproto -g main.c buffers.c url.c auth.c http.c messages.c \
	sendmail.c fetchmail.c html.c \
	format.c cookies.c stringfile.c jsdom.c jsloc.c dbstubs.c >eb.p

#  I've had no luck getting this to work - can you help?
edbrowse.static: $(EBOBJS) tcp.o
	cc --static $(LFLAGS) -o edbrowse.static tcp.o $(EBOBJS) $(LIBS)

