1.PHONY: all static clean regress install
2
3all: Makefile.local gmid TAGS compile_flags.txt
4
5Makefile.local: configure
6	./configure
7
8include Makefile.local
9
10y.tab.c: parse.y
11	${YACC} -b y parse.y
12
13SRCS = gmid.c iri.c utf8.c ex.c server.c sandbox.c mime.c puny.c \
14	utils.c log.c dirs.c fcgi.c
15OBJS = ${SRCS:.c=.o} y.tab.o ${COMPAT}
16
17gmid: ${OBJS}
18	${CC} ${OBJS} -o gmid ${LDFLAGS}
19
20static: ${OBJS}
21	${CC} ${OBJS} -o gmid ${LDFLAGS} ${STATIC}
22
23TAGS: ${SRCS}
24	@(etags ${SRCS} || true) 2>/dev/null
25
26clean:
27	rm -f *.o compat/*.o y.tab.c y.tab.h y.output gmid
28	rm -f compile_flags.txt
29	${MAKE} -C regress clean
30
31regress: gmid
32	${MAKE} -C regress all
33
34install: gmid
35	mkdir -p ${DESTDIR}${BINDIR}
36	mkdir -p ${DESTDIR}${MANDIR}/man1
37	${INSTALL_PROGRAM} gmid ${DESTDIR}${BINDIR}
38	${INSTALL_MAN} gmid.1 ${DESTDIR}${MANDIR}/man1
39
40compile_flags.txt:
41	printf "%s\n" ${CFLAGS} > compile_flags.txt
42
43# make sure we pass -o to ${CC}.  OpenBSD default suffix rule doesn't
44.SUFFIXES: .c .o
45.c.o:
46	${CC} ${CFLAGS} -c $< -o $@
47