2.92 Makefile
 1PREFIX?=/usr/local
 2PREFIX_MAN=$(PREFIX)/man
 3CFLAGS?=-g -Wall -Wextra -pedantic
 4
 5all: snac
 6
 7snac: snac.o main.o sandbox.o data.o http.o httpd.o webfinger.o \
 8    activitypub.o html.o utils.o format.o upgrade.o mastoapi.o rss.o
 9	$(CC) $(CFLAGS) -L$(PREFIX)/lib *.o -lcurl -lcrypto $(LDFLAGS) -pthread -o $@
10
11test: tests/smtp
12
13tests/smtp: tests/smtp.o
14	$(CC) $(CFLAGS) -L$(PREFIX)/lib $< -lcurl $(LDFLAGS) -o $@
15
16.c.o:
17	$(CC) $(CFLAGS) $(CPPFLAGS) -I$(PREFIX)/include -c $< -o $@
18
19clean:
20	rm -rf *.o tests/*.o tests/smtp *.core snac makefile.depend
21
22dep:
23	$(CC) -I$(PREFIX)/include -MM *.c > makefile.depend
24
25install:
26	mkdir -p -m 755 $(PREFIX)/bin
27	install -m 755 snac $(PREFIX)/bin/snac
28	mkdir -p -m 755 $(PREFIX_MAN)/man1
29	install -m 644 doc/snac.1 $(PREFIX_MAN)/man1/snac.1
30	mkdir -p -m 755 $(PREFIX_MAN)/man5
31	install -m 644 doc/snac.5 $(PREFIX_MAN)/man5/snac.5
32	mkdir -p -m 755 $(PREFIX_MAN)/man8
33	install -m 644 doc/snac.8 $(PREFIX_MAN)/man8/snac.8
34
35uninstall:
36	rm $(PREFIX)/bin/snac
37	rm $(PREFIX_MAN)/man1/snac.1
38	rm $(PREFIX_MAN)/man5/snac.5
39	rm $(PREFIX_MAN)/man8/snac.8
40
41update-po:
42	mkdir -p po
43	[ -f "po/en.po" ] || xgettext -o po/en.po --language=C --keyword=L --keyword=LL --from-code=utf-8 *.c
44	for a in po/*.po ; do \
45		sed -i -e '/^#:/d' $$a ; \
46		xgettext --omit-header -j -o $$a --language=C --keyword=L --keyword=LL --from-code=utf-8 *.c ; \
47	done
48
49activitypub.o: activitypub.c xs.h xs_json.h xs_curl.h xs_url.h xs_mime.h \
50 xs_openssl.h xs_regex.h xs_time.h xs_set.h xs_match.h xs_unicode.h \
51 xs_webmention.h xs_http.h xs_http_codes.h snac.h
52data.o: data.c xs.h xs_hex.h xs_io.h xs_json.h xs_openssl.h xs_glob.h \
53 xs_set.h xs_time.h xs_regex.h xs_match.h xs_unicode.h xs_random.h \
54 xs_po.h xs_http.h xs_http_codes.h snac.h
55format.o: format.c xs.h xs_regex.h xs_mime.h xs_html.h xs_json.h \
56 xs_time.h xs_match.h xs_unicode.h snac.h
57html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \
58 xs_time.h xs_mime.h xs_match.h xs_html.h xs_curl.h xs_unicode.h xs_url.h \
59 xs_random.h xs_http.h xs_http_codes.h snac.h
60http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \
61 xs_http.h xs_http_codes.h snac.h
62httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_unix_socket.h \
63 xs_http.h xs_http_codes.h xs_httpd.h xs_mime.h xs_time.h xs_openssl.h \
64 xs_fcgi.h xs_html.h xs_webmention.h snac.h
65main.o: main.c xs.h xs_io.h xs_json.h xs_time.h xs_openssl.h xs_match.h \
66 xs_random.h xs_http.h xs_http_codes.h snac.h
67mastoapi.o: mastoapi.c xs.h xs_hex.h xs_openssl.h xs_json.h xs_io.h \
68 xs_time.h xs_glob.h xs_set.h xs_random.h xs_url.h xs_mime.h xs_match.h \
69 xs_unicode.h xs_http.h xs_http_codes.h snac.h
70rss.o: rss.c xs.h xs_html.h xs_regex.h xs_time.h xs_match.h xs_curl.h \
71 xs_openssl.h xs_json.h xs_http.h xs_http_codes.h xs_unicode.h snac.h
72sandbox.o: sandbox.c xs.h snac.h
73snac.o: snac.c xs.h xs_hex.h xs_io.h xs_unicode_tbl.h xs_unicode.h \
74 xs_json.h xs_curl.h xs_openssl.h xs_socket.h xs_unix_socket.h xs_url.h \
75 xs_http.h xs_http_codes.h xs_httpd.h xs_mime.h xs_regex.h xs_set.h \
76 xs_time.h xs_glob.h xs_random.h xs_match.h xs_fcgi.h xs_html.h xs_po.h \
77 xs_webmention.h xs_list_tools.h snac.h
78upgrade.o: upgrade.c xs.h xs_io.h xs_json.h xs_glob.h snac.h
79utils.o: utils.c xs.h xs_io.h xs_json.h xs_time.h xs_openssl.h \
80 xs_random.h xs_glob.h xs_curl.h xs_regex.h xs_http.h xs_http_codes.h \
81 xs_list_tools.h xs_set.h snac.h
82webfinger.o: webfinger.c xs.h xs_json.h xs_curl.h xs_mime.h xs_http.h \
83 xs_http_codes.h snac.h