-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (40 loc) · 1.04 KB
/
Makefile
File metadata and controls
52 lines (40 loc) · 1.04 KB
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
# Makefile for Binary Serialization Library
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -O2 -I.
LDFLAGS =
# Library
LIB_SRC = binserde.c
LIB_OBJ = binserde.o
LIB = libbinserde.a
# Examples
EXAMPLES = example_file example_network example_evolution
EXAMPLE_SRCS = $(addsuffix .c, $(EXAMPLES))
# All targets
all: $(LIB) $(EXAMPLES)
# Build library
$(LIB): $(LIB_OBJ)
ar rcs $@ $^
$(LIB_OBJ): $(LIB_SRC) binserde.h
$(CC) $(CFLAGS) -c $(LIB_SRC) -o $@
# Build examples
example_file: example_file.c $(LIB)
$(CC) $(CFLAGS) $< -L. -lbinserde -o $@
example_network: example_network.c $(LIB)
$(CC) $(CFLAGS) $< -L. -lbinserde -o $@
example_evolution: example_evolution.c $(LIB)
$(CC) $(CFLAGS) $< -L. -lbinserde -o $@
# Clean
clean:
rm -f $(LIB_OBJ) $(LIB) $(EXAMPLES) *.o
rm -f *.bin *.dat
# Run examples
run-examples: $(EXAMPLES)
@echo "Running file I/O example..."
./example_file
@echo ""
@echo "Running network example..."
./example_network
@echo ""
@echo "Running schema evolution example..."
./example_evolution
.PHONY: all clean run-examples