-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (29 loc) · 758 Bytes
/
Makefile
File metadata and controls
43 lines (29 loc) · 758 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
31
32
33
34
35
36
37
38
39
40
41
42
43
CC = gcc
CFLAGS = -Wall -Wextra -Iinclude -Ilib/sxlist -Ilib/sxfs -g
# Source files
SRC = src/sxjson.c lib/sxlist/dynamic_list.c lib/sxfs/sxfs.c
OBJ = $(SRC:.c=.o)
# Library name
LIB_NAME = libsxjson.a
# Example
EXAMPLE_SRC = examples/main.c
EXAMPLE_BIN = example
# Test
TEST_SRC = tests/test_sxjson.c
TEST_BIN = run_tests
.PHONY: all clean lib example test
all: lib example test
lib: $(LIB_NAME)
$(LIB_NAME): $(OBJ)
ar rcs $@ $^
example: $(EXAMPLE_BIN)
$(EXAMPLE_BIN): $(EXAMPLE_SRC) $(LIB_NAME)
$(CC) $(CFLAGS) -o $@ $^ -L. -lsxjson
test: $(TEST_BIN)
./$(TEST_BIN)
$(TEST_BIN): $(TEST_SRC) $(LIB_NAME)
$(CC) $(CFLAGS) -o $@ $^ -L. -lsxjson
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJ) $(LIB_NAME) $(EXAMPLE_BIN) $(TEST_BIN)