File: Makefile

package info (click to toggle)
fortune-mod 1:1.99.1-7
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 12,808 kB
  • ctags: 640
  • sloc: ansic: 1,957; makefile: 240; python: 35; sh: 15
file content (61 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# COOKIEDIR  must point to the installation directory.
# If OFFENSIVE=1, offensive cookies are installed into OCOOKIEDIR.
# If WCOOKIEDIR=1, html cookies are installed into WCOOKIEDIR.

COOKIES := $(filter-out gen html off Makefile,$(wildcard *))
RECODED := $(addprefix gen/,$(COOKIES))
DAT     := $(addsuffix .dat,$(RECODED))

STRFILE := ../util/strfile

.PHONY: all check clean install

all:: $(RECODED) $(DAT)

$(DAT): gen/%.dat: gen/%
	$(STRFILE) $<

$(RECODED): gen/%: % | gen
	recode latin1..u8 < $< > $@

gen:
	mkdir $@

install:: all
	install -m 0755 -d $(COOKIEDIR)
	install -m 0644 $(RECODED) $(DAT) $(COOKIEDIR)
	for i in $(COOKIES) ; do \
	  ln -sf $$i $(COOKIEDIR)/$$i.u8 ; \
	done

ifeq (1,$(OFFENSIVE))
all install::
	$(MAKE) $@ -C off OCOOKIEDIR=$(OCOOKIEDIR)
endif

ifeq (1,$(WEB))
all install::
	$(MAKE) $@ -C html WCOOKIEDIR=$(WCOOKIEDIR)
endif

clean::
	rm -rf gen
	$(MAKE) $@ -C off
	$(MAKE) $@ -C html

check:
	for i in $(COOKIES) ; \
		do \
			echo -n "Testing $$i..."; \
			if ! tail -n 1 $$i | grep -q ^%$  ; then \
			        echo " failed % check" ; \
				echo "Fortune cookie file does not end in a single %" ; \
				exit 1; \
			fi;\
			if egrep -q ".{72}." $$i ; then \
				echo " failed length check"; \
				echo "Fortune cookie file contains a line longer than 72 characters"; \
				exit 1; \
			fi; \
			echo " passed " ;\
		done;