Debian Codegraph @

datfiles/Makefile

raw ◀ ▶
2 Debian patches touch this file
•1 # COOKIEDIR must point to the installation directory.
2 # If OFFENSIVE=1, offensive cookies are installed into OCOOKIEDIR.
3 # If WCOOKIEDIR=1, html cookies are installed into WCOOKIEDIR.
4
•5 COOKIES := $(filter-out gen html off Makefile,$(wildcard *))
6 RECODED := $(addprefix gen/,$(COOKIES))
•7 DAT := $(addsuffix .dat,$(RECODED))
8
•9 STRFILE := ../util/strfile
10
•11 .PHONY: all check clean install
12
•13 all:: $(RECODED) $(DAT)
14
15 $(DAT): gen/%.dat: gen/%
16 $(STRFILE) $<
17
18 $(RECODED): gen/%: % | gen
19 recode latin1..u8 < $< > $@
20
21 gen:
22 mkdir $@
23
24 install:: all
25 install -m 0755 -d $(COOKIEDIR)
26 install -m 0644 $(RECODED) $(DAT) $(COOKIEDIR)
27 for i in $(COOKIES) ; do \
28 ln -sf $$i $(COOKIEDIR)/$$i.u8 ; \
29 done
30
31 ifeq (1,$(OFFENSIVE))
32 all install::
33 $(MAKE) $@ -C off OCOOKIEDIR=$(OCOOKIEDIR)
34 endif
35
36 ifeq (1,$(WEB))
37 all install::
38 $(MAKE) $@ -C html WCOOKIEDIR=$(WCOOKIEDIR)
39 endif
40
41 clean::
42 rm -rf gen
43 $(MAKE) $@ -C off
44 $(MAKE) $@ -C html
45
46 check:
47 for i in $(COOKIES) ; \
48 do \
49 echo -n "Testing $$i..."; \
50 if ! tail -n 1 $$i | grep -q ^%$ ; then \
51 echo " failed % check" ; \
52 echo "Fortune cookie file does not end in a single %" ; \
53 exit 1; \
54 fi;\
55 if egrep -q ".{72}." $$i ; then \
56 echo " failed length check"; \
57 echo "Fortune cookie file contains a line longer than 72 characters"; \
58 exit 1; \
59 fi; \
60 echo " passed " ;\
61 done;