-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (22 loc) · 705 Bytes
/
Makefile
File metadata and controls
31 lines (22 loc) · 705 Bytes
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
CC = gcc
CFLAGS = -Wall -Wextra -Wconversion -Wdouble-promotion \
-Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion \
-Wshadow -fsanitize=undefined -fsanitize-trap -g
AR = ar rcs
MAIN_SRC = src/main.c
LIB = libsha256lib.a
MAIN_EXEC = sha256
TEST_EXEC = run_tests
SRCS := $(filter-out $(MAIN_SRC), $(wildcard src/*.c))
OBJS := $(SRCS:.c=.o)
all: $(MAIN_EXEC) $(TEST_EXEC)
$(MAIN_EXEC): $(MAIN_SRC) $(LIB)
$(CC) $(CFLAGS) -Isrc -L. $^ -o $@
$(LIB): $(OBJS)
$(AR) $@ $^
src/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(TEST_EXEC): test/test.c $(LIB)
$(CC) $(CFLAGS) -Isrc -L. $^ -o $@
clean:
rm -f $(MAIN_EXEC) $(LIB) $(OBJS) run_tests