-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
58 lines (39 loc) · 1.06 KB
/
Copy pathmakefile
File metadata and controls
58 lines (39 loc) · 1.06 KB
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
# SPDX-FileCopyrightText: © 2023 Remo Dentato <rdentato@gmail.com>
# SPDX-License-Identifier: MIT
# Uncomment the following line to generate a minimal log.
# COMPACT="-DTST_STR_COMPACT"
# Uncomment the following line to disable ANSI colors
# NOCOLOR="-DTST_STR_NOCOLOR"
# Uncomment the following line to enable debugging
# DEBUG="-DDEBUG"
_EXE=.exe
STATIC=-static
ifeq "$(COMSPEC)" ""
_EXE=
STATIC=
endif
CXX_AVAILABLE := $(shell $(CXX) --version 2>/dev/null)
CFLAGS=-O2 -Wall -I../src -I. $(STATIC) $(COMPACT) $(NOCOLOR) $(DEBUG)
LIBS=
TESTS_SRC_C=$(wildcard t_*.c)
TESTS_C=$(TESTS_SRC_C:.c=)
ifneq ($(CXX_AVAILABLE),)
TESTS_SRC_CPP=$(wildcard t_*.cpp)
TESTS_CPP=$(TESTS_SRC_CPP:.cpp=)
CXXFLAGS=$(CFLAGS)
endif
TESTS_SRC=$(TST_SRC_C) $(TST_SRC_CPP)
TESTS=$(TESTS_C) $(TESTS_CPP)
# targets
all: $(TESTS)
SRCDIR=../src
runtest: all
../src/tstrun
MAKEFLAGS += --no-builtin-rules
%.o: %.c
$(CC) $(CFLAGS) -o $*.o -c $<
%: %.o functions.o
$(CC) -o $* $< functions.o -lm
.PRECIOUS: %.o
clean:
rm -f $(TESTS) $(TESTS:=.exe) $(TESTS:=.o) test.log functions.o