-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmakefile
42 lines (32 loc) · 899 Bytes
/
makefile
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
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
SOURCES = $(wildcard chapter-[1-9]/*.c)
SOURCES_CHAPTER_11 = $(wildcard chapter-11/*.c)
NAMES = $(basename $(SOURCES))
NAMES_CHAPTER_11 = $(basename $(SOURCES_CHAPTER_11))
DIRS = $(wildcard ./chapter-*/)
DIST = $(subst ./,dist/,$(DIRS))
DATA = chapter-8/signals.txt
ANNEX_K_SUPPORTED := $(shell cc -dM -E - </dev/null | grep -c __STDC_LIB_EXT1__)
all: $(DIST) $(NAMES) $(NAMES_CHAPTER_11)
$(NAMES): $(SOURCES)
cc [email protected] -o dist/$@
$(NAMES_CHAPTER_11): $(SOURCES_CHAPTER_11)
ifeq ($(ANNEX_K_SUPPORTED),1)
cc [email protected] -o dist/$@
else
cc [email protected] -o dist/$@ -lsafec
endif
$(DIST): $(DIRS)
mkdir -p $@
dist/$(DATA): $(DIST) $(DATA)
cp $(DATA) dist/$(DATA)
.Phony: clean check distcheck failing
clean: dist/*
rm -r dist/
check:
echo "todo: implement $@"
distcheck:
echo "todo: implement $@"
failing: */*.fails
echo */*.fails | tr " " "\n"