-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (39 loc) · 909 Bytes
/
Makefile
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
58
59
CC = clang
###
# Cobbler source file rules
SRC = $(wildcard src/*.c)
OBJ = $(addprefix obj/, $(notdir $(SRC:.c=.o)))
###
# Cobbler demo file rules
examples = $(wildcard examples/*c)
examples_OBJ = $(addprefix obj/, $(notdir $(SRC:.c=.o)))
examples_X = $(examples:.c=)
###
# Compiler Flags
CFLAGS = -I ./include -std=gnu11 -Wall -Werror
LFLAGS =
LIBS = -lpthread
###
# Compile the Cobbler libraries
DYNAMIC = Cobbler.so
STATIC = Cobbler.a
all: $(DYNAMIC) $(STATIC)
$(DYNAMIC): $(OBJ)
$(CC) $(OBJ) $(LFLAGS) -o $@
$(STATIC): $(OBJ)
$(AR) -rcs $@ $(OBJ)
obj/%.o: src/%.c | obj
$(CC) $< -c $(CFLAGS) -o $@
obj:
mkdir -p obj
###
# Compile the Cobbler examples
examples: $(examples_X)
examples/%: examples/%.c $(STATIC) | obj
$(CC) $< $(STATIC) $(CFLAGS) $(LIBS) -o $@
###
# Clean
clean:
rm -Rf $(OBJ) $(examples_OBJ) $(STATIC) $(DYNAMIC)
realclean: clean
rm -Rf ./obj $(examples_X)