1
1
# lug - Embedded DSL for PE grammar parsers in C++
2
+ # Copyright (c) 2017-2025 Jesse W. Towner
2
3
# See LICENSE file for copyright and license details
3
4
5
+ # This is a POSIX.1-2014 compliant Makefile. It is known to work with GNU Make, NetBSD Make and PDP Make.
6
+ # https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html
7
+ .POSIX :
8
+ .PHONY : all clean dist install uninstall options test testsuite runtestsuite samples runsamples lint clangtidy shellcheck tools unicode
9
+ .SUFFIXES : .cpp .o
10
+
4
11
# distribution version
5
12
VERSION = 0.5.0
6
13
14
+ # unicode character database version
15
+ UCD_VERSION = 16.0.0
16
+
7
17
# paths
8
18
PREFIX = /usr/local
9
19
10
20
# toolchain
21
+ CXX = c++
11
22
CXXSTD = -std=c++17
12
23
CXXWARNFLAGS = -pedantic -Wall -Wconversion -Wextra -Wextra-semi -Wshadow -Wsign-conversion -Wsuggest-override -Wno-parentheses -Wno-logical-not-parentheses
13
24
CXXOPTFLAGS = -Os -ffunction-sections -fdata-sections
@@ -39,9 +50,6 @@ TOOLS_OBJ = $(TOOLS:%=tools/%.o)
39
50
HEADER_NAMES = detail error iostream unicode utf8 lug
40
51
HEADERS = $(HEADER_NAMES:%=include/lug/%.hpp )
41
52
42
- # unicode character database version
43
- UCD_VERSION = 16.0.0
44
-
45
53
# shell scripts
46
54
SHELLSCRIPTS = runsamples.sh runtests.sh tools/fetchucd.sh
47
55
@@ -51,7 +59,7 @@ DISTDOCFILES = CHANGELOG.md LICENSE.md README.md
51
59
DISTPROJFILES = CMakeLists.txt Makefile runsamples.sh runtests.sh .clang-tidy .editorconfig .gitattributes .gitignore
52
60
DISTFILES = $(DISTDOCFILES ) $(DISTPROJFILES ) $(DISTDIRS )
53
61
54
- all : options samples tests
62
+ all : options testsuite samples
55
63
56
64
.cpp.o :
57
65
@echo CXX $<
@@ -65,24 +73,29 @@ $(SAMPLES_BIN): $(SAMPLES_OBJ)
65
73
66
74
samples : $(SAMPLES_BIN )
67
75
76
+ runsamples : samples $(SAMPLES_TESTPLANS )
77
+ @sh runsamples.sh $(SAMPLES_TESTPLANS )
78
+
68
79
$(TESTS_OBJ ) : $(HEADERS )
69
80
70
81
$(TESTS_BIN ) : $(TESTS_OBJ )
71
82
@echo LD $@
72
83
@$(CXX ) -o $@ $@ .o $(LDFLAGS )
73
84
74
- tests : $(TESTS_BIN )
85
+ testsuite : $(TESTS_BIN )
75
86
76
- check : tests samples $( SAMPLES_TESTPLANS )
87
+ runtestsuite : testsuite
77
88
@sh runtests.sh $(TESTS_BIN )
78
- @echo
79
- @sh runsamples.sh $(SAMPLES_TESTPLANS )
89
+
90
+ test : runtestsuite runsamples
91
+
92
+ clangtidy :
93
+ @$(CLANGTIDY ) --quiet $(CXXFLAGS:%=--extra-arg=% ) $(HEADERS )
80
94
81
95
shellcheck :
82
96
@$(SHELLCHECK ) -s sh $(SHELLSCRIPTS )
83
97
84
- tidy :
85
- @$(CLANGTIDY ) --quiet $(CXXFLAGS:%=--extra-arg=% ) $(HEADERS )
98
+ lint : clangtidy shellcheck
86
99
87
100
$(TOOLS_OBJ ) : $(HEADERS )
88
101
@@ -100,13 +113,16 @@ unicode: tools
100
113
101
114
options :
102
115
@echo lug build options:
103
- @echo " CXX = $( CXX) "
104
- @echo " CXXSTD = $( CXXSTD) "
105
- @echo " CXXFLAGS = $( CXXFLAGS) "
106
- @echo " LDFLAGS = $( LDFLAGS) "
107
- @echo " CLANGTIDY = $( CLANGTIDY) "
108
- @echo " PREFIX = $( PREFIX) "
109
- @echo " UCD_VERSION = $( UCD_VERSION) "
116
+ @echo " CXX = $( CXX) "
117
+ @echo " CXXSTD = $( CXXSTD) "
118
+ @echo " CXXWARNFLAGS = $( CXXWARNFLAGS) "
119
+ @echo " CXXOPTFLAGS = $( CXXOPTFLAGS) "
120
+ @echo " CXXFLAGS = $( CXXFLAGS) "
121
+ @echo " LDFLAGS = $( LDFLAGS) "
122
+ @echo " CLANGTIDY = $( CLANGTIDY) "
123
+ @echo " SHELLCHECK = $( SHELLCHECK) "
124
+ @echo " PREFIX = $( PREFIX) "
125
+ @echo " UCD_VERSION = $( UCD_VERSION) "
110
126
111
127
clean :
112
128
@echo cleaning
@@ -146,5 +162,3 @@ uninstall:
146
162
@rm -f $(DESTDIR )$(PREFIX ) /include/lug/unicode.hpp
147
163
@rm -f $(DESTDIR )$(PREFIX ) /include/lug/utf8.hpp
148
164
@rmdir $(DESTDIR )$(PREFIX ) /include/lug
149
-
150
- .PHONY : all samples tests check shellcheck tidy tools unicode options clean dist install uninstall
0 commit comments