-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
101 lines (73 loc) · 2.8 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# PStreams Makefile
# Copyright (C) 2001 - 2022 Jonathan Wakely
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0
# TODO configure script (allow doxygenating of EVISCERATE functions)
OPTIM= -O1 -g3
EXTRA_CXXFLAGS=
CFLAGS=-pedantic -Wall -Wextra -Wpointer-arith -Wcast-qual -Wcast-align -Wredundant-decls -Wshadow $(OPTIM)
CXXFLAGS=$(CFLAGS) -Woverloaded-virtual
prefix = /usr/local
includedir = $(prefix)/include
INSTALL = install
INSTALL_DATA = $(INSTALL) -p -v -m 0644
SOURCES = pstream.h
TESTS = test_pstreams test_minimum
GENERATED_FILES = ChangeLog MANIFEST
EXTRA_FILES = AUTHORS LICENSE_1_0.txt Doxyfile INSTALL.md Makefile README \
mainpage.html test_pstreams.cc test_minimum.cc pstreams-devel.spec
DIST_FILES = $(SOURCES) $(GENERATED_FILES) $(EXTRA_FILES)
HASH := \#
VERS := $(shell awk -F' ' '/^$(HASH)define *PSTREAMS_VERSION/{ print $$NF }' pstream.h)
all: $(TESTS) | pstreams.wout
check run_tests test: all
@status=0 ; \
log=`mktemp test.XXXXXX` ; \
for test in $(TESTS) ; do \
printf "Running %-20s ... " $$test ; \
./$$test >$$log 2>&1 && echo OK && continue ; \
echo "FAILED [exit status $$?]" ; cat $$log >&2 ; status=1; \
done ; \
rm $$log ; \
exit $$status
check-werror:
@$(MAKE) EXTRA_CXXFLAGS+=-Werror all check
test_%: test_%.cc pstream.h FORCE
$(CXX) $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(LDFLAGS) -o $@ $< -std=c++98
$(CXX) $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(LDFLAGS) -o $@ $<
MANIFEST: Makefile
@for i in $(DIST_FILES) ; do echo "pstreams-$(VERS)/$$i" ; done > $@
docs: pstream.h mainpage.html
@doxygen Doxyfile
mainpage.html: pstream.h Makefile
@perl -pi -e "s/^(<p>Version) [0-9\.]*(<\/p>)/\1 $(VERS)\2/" $@
ChangeLog:
@if [ -d .git ]; then git log --no-merges | grep -v '^commit ' > $@ ; fi
dist: pstreams-$(VERS).tar.gz pstreams-docs-$(VERS).tar.gz
srpm: pstreams-$(VERS).tar.gz
@rpmbuild -ts $<
pstreams-$(VERS):
@ln -s . $@
pstreams-$(VERS).tar.gz: pstream.h $(GENERATED_FILES) pstreams-$(VERS)
@tar -czvf $@ `cat MANIFEST`
pstreams-docs-$(VERS):
@ln -s doc/html $@
pstreams-docs-$(VERS).tar.gz: docs pstreams-docs-$(VERS)
@tar -czvhf $@ pstreams-docs-$(VERS)
TODO : pstream.h mainpage.html test_pstreams.cc
@grep -nH TODO $^ | sed -e 's@ *// *@@' > $@
clean:
@rm -f test_minimum test_pstreams
@rm -rf doc TODO $(GENERATED_FILES)
@rm -f *.tar.gz pstreams-$(VERS) pstreams-docs-$(VERS)
install:
@install -d $(DESTDIR)$(includedir)/pstreams
@$(INSTALL_DATA) pstream.h $(DESTDIR)$(includedir)/pstreams/pstream.h
pstreams.wout:
@echo "Wide Load" | iconv -f ascii -t UTF-32 > $@
.PHONY: TODO check test run_tests dist srpm FORCE
.INTERMEDIATE: $(GENERATED_FILES) pstreams-$(VERS) pstreams-docs-$(VERS)
# vim: sw=2 ts=8 noexpandtab