-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·79 lines (63 loc) · 1.47 KB
/
Makefile
File metadata and controls
executable file
·79 lines (63 loc) · 1.47 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
CC = gcc
ODIR = bin
CCDIR = coverage
ONAME = libbmff
INSTALL_DIR = /usr/local
CCOBJDIR = $(CCDIR)/obj
CFLAGS = -Ibin -Lbin
LIBS = -lbmff
SRC_HDRS = src/bmff.h src/boxes.h src/descriptors.h
.SECONDEXPANSION:
OBJ_SRC := $(patsubst %.c, %.o, $(wildcard src/*.c))
DEBUG ?= 0
COVERAGE ?= 0
PROFILING ?= 0
ifeq ($(COVERAGE), 1)
CFLAGS += -fprofile-arcs -ftest-coverage -fprofile-dir=$(CCOBJDIR)
DEBUG = 1
endif
ifeq ($(PROFILING), 1)
CFLAGS += -pg
DEBUG = 1
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O2
endif
all: static tests examples
.PHONY: style static tests check clean
style:
astyle --style=linux -n src/*.h src/*.c
static: $(OBJ_SRC)
mkdir -p $(ODIR)
ar rcs $(ODIR)/$(ONAME).a $(OBJ_SRC)
cp $(SRC_HDRS) $(ODIR)/
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
install: static
mkdir -p $(INSTALL_DIR)/include/$(ONAME)
mkdir -p $(INSTALL_DIR)/lib
cp $(ODIR)/*.h $(INSTALL_DIR)/include/$(ONAME)/
cp $(ODIR)/$(ONAME).a $(INSTALL_DIR)/lib/
remove:
rm -f $(INSTALL_DIR)/include/$(ONAME)/*.h
rm -r -f $(INSTALL_DIR)/include/$(ONAME)
rm -f $(INSTALL_DIR)/lib/$(ONAME).a
tests: static
$(MAKE) -C test/
examples: static
$(MAKE) -C examples/
check:
ifeq ($(COVERAGE), 1)
$(MAKE) -C . clean
endif
$(MAKE) -C test/ check
clean:
$(MAKE) -C test/ clean
$(MAKE) -C examples/ clean
rm -f -r $(ODIR)
find . -type f -name '*.o' -exec rm {} \;
find . -type f -name '*.dSYM' -exec rm {} \;
find . -type f -name '*.gcno' -exec rm {} \;
find . -type f -name '*.gcda' -exec rm {} \;