aboutsummaryrefslogtreecommitdiffstats
path: root/packages.mk
blob: 3ca60bfd7e00b377f4aeda8bc5d5069d61719e7b (plain) (blame)
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
# vim: set ts=8 sts=8 sw=8 ft=make:

.POSIX:
.PHONY: all clean clean-exe clean-doc distclean $(PLATFORM)
.SUFFIXES: .txt .html

V=               0
CC=              c99
ASCIIDOC=        asciidoc

RM_IF_FAIL=      || { rm -f "$@" && false; }

PLATFORM_SH=   $(PLATFORM).sh
PLATFORM_IN=   $(PLATFORM).in
PLATFORM_OUT=  $(PLATFORM).out
PLATFORM_DOC=  $(PLATFORM).doc

PKGLIST_IN=  $(PLATFORM_IN)/$(PLATFORM).pkg
PKGLIST_OUT= $(PLATFORM_OUT)/$(PLATFORM).list

# Include silent rules
include Makefile.silent

# Do platform-independent tasks
all: README.html $(PLATFORM)

# Generate top-level directory documentation
.txt.html:
    -$(AT_DOC)$(ASCIIDOC) -b html -o "$@" "$<"

# Generate package list
$(PKGLIST_OUT): $(PKGLIST_IN) packages.h packages.sh
    -$(AT_MKDIR)mkdir -p $(PLATFORM_OUT)
    $(AT_CPP)CPPFLAGS="-I. -I$(PLATFORM_IN)" ./packages.sh $(PLATFORM) \
        | sort | uniq > $(PKGLIST_OUT) $(RM_IF_FAIL)

# Clean files
clean:
    rm -rf *.out $(CLEAN_FILES)
clean-exe:
    rm -f $(CLEAN_EXE_FILES)
clean-doc:
    rm -f *.html $(CLEAN_DOC_FILES)

distclean: clean clean-exe clean-doc