-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile.in
148 lines (118 loc) · 3.4 KB
/
Makefile.in
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#
# Makefile for codedoc, a code documentation utility.
#
# https://www.msweet.org/codedoc
#
# Copyright © 2003-2024 by Michael R Sweet.
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
# POSIX makefile
.POSIX:
# Build silently
.SILENT:
# Version number...
VERSION = @VERSION@
# Programs and options...
ASAN_OPTIONS = leak_check_at_exit=false
CC = @CC@
CFLAGS = -I.. @CFLAGS@ $(CPPFLAGS) $(OPTIM) $(WARNINGS)
CPPFLAGS = @CPPFLAGS@ '-DVERSION="$(VERSION)"'
CSFLAGS = -s "$${CODESIGN_IDENTITY:=-}" --timestamp @CSFLAGS@
INSTALL = @INSTALL@
LDFLAGS = @LDFLAGS@ $(OPTIM)
LIBS = @LIBS@
MKDIR = @MKDIR@ -p
OPTIM = @OPTIM@
RM = @RM@ -f
SHELL = /bin/sh
WARNINGS = @WARNINGS@
# Directories...
bindir = @bindir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
exec_prefix = @exec_prefix@
includedir = @includedir@
infodir = @infodir@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
privateinclude = @privateinclude@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
top_srcdir = @top_srcdir@
unitdir = @unitdir@
BUILDROOT = ${DSTROOT}${RPM_BUILD_ROOT}${DESTDIR}
# Project targets...
DOCFILES = \
codedoc.html \
codedoc-256.png
DOCOPTIONS = \
--author "Michael R Sweet" \
--copyright "Copyright © 2003-2024 by Michael R Sweet" \
--coverimage codedoc-256.png \
--docversion $(VERSION)
OBJS = \
codedoc.o \
mmd.o \
zipc.o
TARGETS = \
codedoc \
codedoc.html
# General build rules...
.SUFFIXES: .c .o
.c.o:
echo "Compiling $<..."
$(CC) $(CFLAGS) -c -o $@ $<
# Build targets...
all: $(TARGETS)
clean:
echo "Cleaning all output..."
rm -f $(TARGETS) $(OBJS)
install: $(TARGETS)
echo "Installing program to $(BUILDROOT)$(bindir)..."
$(INSTALL) -d -m 755 $(BUILDROOT)$(bindir)
$(INSTALL) -c -m 755 codedoc $(BUILDROOT)$(bindir)
echo "Installing documentation to $(BUILDROOT)$(mandir)..."
$(INSTALL) -d -m 755 $(BUILDROOT)$(mandir)/man1
$(INSTALL) -c -m 644 codedoc.1 $(BUILDROOT)$(mandir)/man1
echo "Installing documentation to $(BUILDROOT)$(docdir)..."
$(INSTALL) -d -m 755 $(BUILDROOT)$(docdir)
for file in $(DOCFILES); do \
$(INSTALL) -c -m 644 $$file $(BUILDROOT)$(docdir); \
done
cppcheck:
cppcheck --template=gcc --addon=cert.py --suppress=cert-MSC24-C --suppress=cert-EXP05-C --suppress=cert-API01-C --suppress=cert-INT31-c --suppress=cert-STR05-C $(OBJS:.o=.c) 2>cppcheck.log
@test -s cppcheck.log && (echo ""; echo "Errors detected:"; echo ""; cat cppcheck.log; exit 1) || exit 0
TESTOPTIONS = \
--body testfiles/body.md \
--title "Test Documentation" \
--footer DOCUMENTATION.md
test: codedoc
echo "Running tests..."
rm -f test.xml
./codedoc $(DOCOPTIONS) $(TESTOPTIONS) test.xml testfiles/*.cxx >test.html
./codedoc $(DOCOPTIONS) $(TESTOPTIONS) --man test test.xml >test.man
./codedoc $(DOCOPTIONS) $(TESTOPTIONS) --epub test.epub test.xml
codedoc: $(OBJS)
echo "Linking $@..."
$(CC) $(LDFLAGS) -o codedoc $(OBJS) $(LIBS)
if test `uname` = Darwin; then \
echo "Code-signing $@..."; \
codesign $(CSFLAGS) --prefix org.msweet. $@; \
fi
codedoc.html: codedoc DOCUMENTATION.md
echo "Formatting $@..."
./codedoc $(DOCOPTIONS) --body DOCUMENTATION.md >codedoc.html
# Dependencies...
$(OBJS): Makefile
codedoc.o: mmd.h zipc.h
mmd.o: mmd.h
zipc.o: zipc.h