1# eschalot Makefile
2
3# If you modify the Makefile, please make sure it works with
4# both BSD and GNU makes. Avoid the fancy features.
5
6PROG1		?= eschalot
7PROG2		?= worgen
8PROG3		?= typecard
9
10PREFIX		?= /usr/local
11BINDIR		?= ${PREFIX}/bin
12
13LIBS		+= -lpthread -lssl -lcrypto
14
15WARNINGS	+= -Wall -W -Wunused -pedantic -Wpointer-arith \
16		-Wreturn-type -Wstrict-prototypes \
17		-Wmissing-prototypes -Wshadow -Wcast-qual -Wextra
18
19CFLAGS		+= -std=c99
20CFLAGS		+= -fPIC
21CFLAGS		+= -finline-functions
22#CFLAGS		+= -fomit-frame-pointer
23#CFLAGS		+= -m64
24#CFLAGS		+= -mtune=native -march=native
25#CFLAGS		+= -g
26
27DEBUGFLAGS	+= -g -rdynamic
28
29ifneq ($(OS),Windows_NT)
30    UNAME_S := $(shell uname -s)
31    ifeq ($(UNAME_S),Darwin)
32		LIBS += -L/usr/local/opt/openssl/lib
33		CFLAGS += -I/usr/local/opt/openssl/include
34    endif
35endif
36
37CC		?= cc
38INSTALL		?= install -c -o root -g bin -m 755
39RM		?= /bin/rm -f
40
41all:		${PROG1} ${PROG2}
42
43${PROG1}:	${PROG1}.c Makefile
44		${CC} ${CFLAGS} ${WARNINGS} -o $@ ${PROG1}.c ${LIBS}
45
46${PROG2}:	${PROG2}.c Makefile
47		${CC} ${CFLAGS} ${WARNINGS} -o $@ ${PROG2}.c
48
49# make typecard - quick overview of the basic types on the system
50${PROG3}: 	${PROG3}.c Makefile
51		${CC} ${CFLAGS} -o $@ ${PROG3}.c
52		./${PROG3}
53
54install:	all
55		${INSTALL} ${PROG1} ${BINDIR}
56		${INSTALL} ${PROG2} ${BINDIR}
57
58clean:
59		${RM} ${PROG1} ${PROG2} ${PROG3} *.o *.p *.d *.s *.S *~ *.core .depend
60
61# Simple procedure to speed up basic testing on multiple platforms
62WF1		= top150adjectives.txt
63WF2		= top400nouns.txt
64WF3		= top1000.txt
65WLIST		= wordlist.txt
66RESULTS		= results.txt
67
68test:		all
69		./${PROG2} 8-16 ${WF1} 3-16 ${WF2} 3-16 ${WF3} 3-16 > ${WLIST}
70		./${PROG1} -vct4 -f ${WLIST} >> ${RESULTS}
71
72cleantest:
73		${RM} ${WLIST} ${RESULTS}
74
75cleanall:	clean cleantest
76
77debug: CFLAGS += ${DEBUGFLAGS}
78debug: all
79