Blob


1 # Copyright (c) 2022 Omar Polo <op@omarpolo.com>
2 # Copyright (c) 2011, 2013-2022 Ingo Schwarze <schwarze@openbsd.org>
3 # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 #
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 # tests to run as a port of the regression suite. Leave empty to run
18 # all.
19 TESTS=
21 # host to bind to during regress
22 REGRESS_HOST = localhost
24 # -- build-related variables --
26 COBJS = ${COMPATS:.c=.o}
28 GMID_SRCS = gmid.c config.c crypto.c dirs.c fcgi.c iri.c log.c \
29 logger.c mime.c proc.c proxy.c puny.c sandbox.c \
30 server.c utf8.c utils.c y.tab.c
32 GMID_OBJS = ${GMID_SRCS:.c=.o} ${COBJS}
34 GE_SRCS = ge.c config.c crypto.c dirs.c fcgi.c iri.c log.c mime.c \
35 proc.c proxy.c puny.c sandbox.c server.c utf8.c utils.c
37 GE_OBJS = ${GE_SRCS:.c=.o} ${COBJS}
39 GG_SRCS = gg.c iri.c utf8.c
41 GG_OBJS = ${GG_SRCS:.c=.o} ${COBJS}
43 SRCS = gmid.h log.h parse.y proc.h \
44 ${GMID_SRCS} ${GE_SRCS} ${GG_SRCS}
46 DISTNAME = gmid-${VERSION}
48 # -- public targets --
50 all: config.mk gmid ge gg
51 .PHONY: all tags static clean cleanall test regress install
53 config.mk config.h: configure
54 @echo "$@ is out of date; please run ./configure"
55 @exit 1
57 include config.mk
59 clean:
60 rm -f *.[do] compat/*.[do] y.tab.c y.tab.h y.output gmid ge gg
61 rm -f compile_flags.txt
62 ${MAKE} -C regress clean
64 distclean: clean
65 rm -f config.h config.h.old config.log config.log.old config.mk
67 test: regress
68 regress: all
69 ${MAKE} 'TESTS=${TESTS}' -C regress all
71 install: gmid gg ge
72 mkdir -p ${DESTDIR}${BINDIR}
73 mkdir -p ${DESTDIR}${MANDIR}/man1
74 mkdir -p ${DESTDIR}${MANDIR}/man5
75 mkdir -p ${DESTDIR}${MANDIR}/man8
76 ${INSTALL_PROGRAM} gmid ${DESTDIR}${BINDIR}
77 ${INSTALL_PROGRAM} gg ${DESTDIR}${BINDIR}
78 ${INSTALL_PROGRAM} ge ${DESTDIR}${BINDIR}
79 ${INSTALL_MAN} gmid.8 ${DESTDIR}${MANDIR}/man8
80 ${INSTALL_MAN} gmid.conf.5 ${DESTDIR}${MANDIR}/man5
81 ${INSTALL_MAN} ge.1 ${DESTDIR}${MANDIR}/man1
82 ${INSTALL_MAN} gg.1 ${DESTDIR}${MANDIR}/man1
84 uninstall:
85 rm ${DESTDIR}${BINDIR}/ge
86 rm ${DESTDIR}${BINDIR}/gg
87 rm ${DESTDIR}${BINDIR}/gmid
88 rm ${DESTDIR}${MANDIR}/man1/ge.1
89 rm ${DESTDIR}${MANDIR}/man1/gg.1
90 rm ${DESTDIR}${MANDIR}/man5/gmid.conf.5
91 rm ${DESTDIR}${MANDIR}/man8/gmid.8
93 tags:
94 ctags ${SRCS}
96 # --internal build targets --
98 gmid: ${GMID_OBJS}
99 ${CC} ${GMID_OBJS} -o $@ ${LIBS} ${LDFLAGS}
101 ge: ${GE_OBJS}
102 ${CC} ${GE_OBJS} -o $@ ${LIBS} ${LDFLAGS}
104 gg: ${GG_OBJS}
105 ${CC} ${GG_OBJS} -o $@ ${LIBS} ${LDFLAGS}
107 y.tab.c: parse.y
108 ${YACC} -b y parse.y
110 # make sure we pass -o to ${CC}. OpenBSD default suffix rule doesn't
111 .SUFFIXES: .c .o
112 .c.o:
113 ${CC} ${CFLAGS} -c $< -o $@
115 # -- maintainer targets --
117 .PHONY: release dist
119 DISTFILES = .cirrus.yml .dockerignore .gitignore ChangeLog LICENSE \
120 Makefile README.md config.c configure configure.local.example \
121 crypto.c dirs.c fcgi.c ge.1 ge.c gg.1 gg.c gmid.8 gmid.c \
122 gmid.conf.5 gmid.h iri.c log.c log.h logger.c mime.c \
123 parse.y proxy.c puny.c sandbox.c server.c utf8.c utils.c \
124 y.tab.c
126 release:
127 sed -i -e '/^RELEASE=/s/no/yes' configure
128 ${MAKE} dist
129 sed -i -e '/^RELEASE=/s/yes/no' configure
131 dist: ${DISTNAME}.sha256
133 ${DISTNAME}.sha256: ${DISTNAME}.tar.gz
135 ${DISTNAME}.tar.gz: ${DISTFILES}
136 mkdir -p .dist/${DISTNAME}/
137 ${INSTALL} -m 0644 ${DISTFILES} .dist/${DISTNAME}/
138 cd .dist/${DISTNAME} && chmod 755 configure
139 ${MAKE} -C compat DESTDIR=${PWD}/.dist/${DISTNAME}/compat dist
140 ${MAKE} -C contrib DESTDIR=${PWD}/.dist/${DISTNAME}/contrib dist
141 ${MAKE} -C have DESTDIR=${PWD}/.dist/${DISTNAME}/have dist
142 ${MAKE} -C regress DESTDIR=${PWD}/.dist/${DISTNAME}/regress dist
143 cd .dist/ && tar zcf ../$@ ${DISTNAME}
144 rm -rf .dist/
146 # -- dependencies --
148 -include config.d
149 -include crypto.d
150 -include dirs.d
151 -include fcgi.d
152 -include ge.d
153 -include gg.d
154 -include gmid.d
155 -include iri.d
156 -include log.d
157 -include logger.d
158 -include mime.d
159 -include proc.d
160 -include proxy.d
161 -include puny.d
162 -include sandbox.d
163 -include server.d
164 -include utf8.d
165 -include utils.d
166 -include y.tab.d