Initial commit
[profile/ivi/fontpackages.git] / private / repo-font-audit.mk
1 # Directory with files to process
2 SRCDIR = src
3 # Work area
4 TMPDIR = $(wildcard tmp)
5
6 this_makefile := $(lastword $(MAKEFILE_LIST))
7 datadir := $(dir $(this_makefile))
8
9 SUBDIRS := $(wildcard */)
10
11 ifneq ($(TMPDIR),)
12 FONT_TARGET_ROOTS := $(subst .rfo.fonts.info,.rfo,$(shell find $(TMPDIR) -name "*\.rfo\.fonts\.info"))
13
14 FONT_EXTS := fontlint unicover fc-query fonts
15 add_font_ext = $(foreach file, $(FONT_TARGET_ROOTS),$(file).$(ext))
16 FONT_TARGETS := $(foreach ext, $(FONT_EXTS), $(add_font_ext))
17
18 CORE_FONT_TARGETS := $(subst .rfo.core-fonts.info,.rfo.core-fonts,$(shell find $(TMPDIR) -name "*\.rfo\.core-fonts\.info"))
19 endif
20
21 ifneq ($(wildcard font-links.txt),)
22 LINK_TARGETS := processed-font-links.txt
23 endif
24
25 TARGETS := $(FONT_TARGETS) $(CORE_FONT_TARGETS) $(LINK_TARGETS)
26
27 ifneq ($(TARGETS),)
28 TARGETS := $(TARGETS) rpmlint.txt
29 endif
30
31 .PHONY: $(SUBDIRS) all rfo
32
33 all : $(SUBDIRS)
34
35 $(SUBDIRS) :
36         $(MAKE) -C $@ rfo -f $(this_makefile)
37
38 ifneq ($(TARGETS),)
39 rfo : $(TARGETS)
40 else
41 rfo : ; @echo "$(shell pwd): nothing to do!"
42 endif
43
44 $(TMPDIR)/%.rfo.fonts : rpm-info.txt \
45                         rpmlint.score \
46                         $(SRCDIR)/% \
47                         $(TMPDIR)/%.rfo.fonts.info \
48                         $(TMPDIR)/%.rfo.fontlint \
49                         $(TMPDIR)/%.rfo.unicover \
50                         $(TMPDIR)/%.rfo.fc-query.report \
51                         $(TMPDIR)/%.rfo.fc-query
52         $(datadir)/fonts-report $^ > $@
53         @echo -n "f"
54
55 $(TMPDIR)/%.rfo.unicover : $(SRCDIR)/%
56         ttfcoverage $< > $@
57
58 $(TMPDIR)/%.rfo.fontlint : $(SRCDIR)/%
59         LANG=C fontlint $(CURDIR)/$< > $@ 2>&1 || :
60
61 $(TMPDIR)/%.rfo.fc-query $(TMPDIR)/%.rfo.fc-query.report : $(SRCDIR)/%
62         $(datadir)/process-fc-query $< $(TMPDIR)/$*.rfo.fc-query > $(TMPDIR)/$*.rfo.fc-query.report
63
64 $(TMPDIR)/%.rfo.core-fonts : rpm-info.txt \
65                              rpmlint.score \
66                              $(SRCDIR)/% \
67                              $(TMPDIR)/%.rfo.core-fonts.info
68         $(datadir)/core-fonts-report $^ > $@
69         @echo -n "X"
70
71 rpmlint.txt rpmlint.score :
72         rpmlint -i "*.rpm" > rpmlint.txt 2>&1 \
73           && touch rpmlint.score || echo "$$?" > rpmlint.score
74
75 processed-font-links.txt : rpm-info.txt \
76                            rpmlint.score \
77                            font-links.txt
78         $(datadir)/font-links-report $^ > $@
79         @echo -n "l"