Skip to content

Commit 859f4b0

Browse files
committed
hp_list: Modularize build system
It is straightforward to extend. For example, if we are about to add "release" build, we can add the following: release: CFLAGS += -O2 -DNDEBUG release: $(BIN)
1 parent 9fa5bf8 commit 859f4b0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

hp_list/Makefile

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
all:
2-
$(CC) -Wall -o list main.c -lpthread -g -fsanitize=thread
1+
CC ?= gcc
2+
CFLAGS = -Wall -g
3+
CFLAGS += -fsanitize=thread
4+
LIBS = -lpthread
5+
BIN = list
6+
7+
all: list
8+
9+
$(BIN): main.c
10+
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
11+
12+
all: CFLAGS += -O2
13+
all: $(BIN)
314

415
indent:
516
clang-format -i *.[ch]

0 commit comments

Comments
 (0)