Skip to content

Commit 88d52ba

Browse files
authored
Merge pull request #1 from Sigmanificient/makefile-fixup
Fixup the Makefile; remove criterion sources
2 parents 1143d92 + ef2cf4f commit 88d52ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+31
-9167
lines changed

Makefile

+31-29
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,48 @@
33
## general makefile
44
##
55

6-
SRC = $(shell find exercises -name "*.c")
7-
TEST_SRC = $(shell find tests -name "*.c")
8-
OBJ = $(SRC:.c=.o)
9-
TEST_OBJ = $(TEST_SRC:.c=.o)
10-
COV = ./*.gcda ./*.gcno
6+
.SUFFIXES: .o
117

12-
NAME = superlib.a
13-
TEST_FILE_NAME =tests.out
8+
CC ?= gcc
149

15-
all: $(NAME)
10+
SRC := $(shell find exercises -name "*.c")
11+
TEST_SRC := $(shell find tests -name "*.c")
1612

17-
$(NAME): $(OBJ)
18-
ar rc $(NAME) $(OBJ)
19-
echo "Library compiled successfully"
13+
OBJ := $(SRC:.c=.o)
14+
TEST_OBJ := $(TEST_SRC:.c=.o)
2015

16+
NAME := superlib.a
17+
TEST_FILENAME := tests.out
18+
19+
.PHONY: all
20+
all: $(NAME)
21+
22+
$(NAME): $(OBJ)
23+
$(AR) rc $@ $^
24+
25+
.PHONY: clean
2126
clean:
22-
rm -f $(OBJ)
23-
echo "Cleaned .o"
27+
$(RM) $(OBJ) $(TEST_OBJ)
2428

29+
.PHONY: fclean
2530
fclean: clean
26-
rm -f $(NAME)
27-
echo "Cleaned '$(NAME)'"
28-
rm -f $(TEST_FILE_NAME)
29-
rm -f $(TEST_OBJ)
30-
rm -rf *.gcno *.gcda
31-
echo "Cleaned '$(TEST_FILE_NAME)' binary & residual files"
31+
$(RM) $(NAME) $(TEST_FILENAME)
32+
$(RM) $(wildcard $(TEST_FILENAME)-*.gc??) $(TEST_SRC:.c=.gcno)
3233

34+
.PHONY: re
35+
.NOTPARALLEL: re
3336
re: fclean all
3437

35-
test: $(TEST_OBJ)
36-
gcc -fprofile-arcs -ftest-coverage -o $(TEST_FILE_NAME) $(TEST_OBJ) $(SRC) -lcriterion
38+
$(TEST_FILENAME): CFLAGS += -fprofile-arcs -ftest-coverage
39+
$(TEST_FILENAME): $(TEST_OBJ) $(SRC)
40+
$(CC) $(CFLAGS) -o $@ $^ -lcriterion
3741

38-
run: fclean test
39-
./$(TEST_FILE_NAME) --verbose
42+
.PHONY: run
43+
.NOTPARALLEL: run
44+
run: fclean $(TEST_FILENAME)
45+
./$(TEST_FILENAME) --verbose
4046

41-
runc: test
47+
.PHONY: runc
48+
runc: run
4249
gcovr -e tests
4350
gcovr -e tests -bu
44-
45-
norm:
46-
./csc.sh exercises .
47-
48-
.PHONY: all clean fclean re test run runc norm

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ The final Makefile, located in `/`, executes (and if they all pass, verifies) al
2323
- A terminal (Bash, Zsh, etc.)
2424
- A brain (optional)
2525

26-
A [static Criterion install](https://github.com/Snaipe/Criterion) is located in `/criterion/`.
2726
**Please open an issue if it results in the impossibility to compile/run the tests.**
2827
Criterion tests for each exercise are run with the command `make run`.
2928

criterion/include/criterion/abort.h

-66
This file was deleted.

0 commit comments

Comments
 (0)