-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
37 lines (28 loc) · 860 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
CC_PREFIX =
CC = $(CC_PREFIX)gcc
STRIP = $(CC_PREFIX)strip
LINKER = $(CC)
SRCDIR = ./src
INCDIR = ./inc
TESTDIR = ./test
SRC_FILES = $(shell find $(SRCDIR) -name *.c)
LIB_OBJS = $(patsubst %.c, %.o, $(SRC_FILES))
TEST_FILES = $(shell find $(TESTDIR) -name *.c)
APP_OBJS = $(patsubst %.c, %.o, $(TEST_FILES))
CFLAGS = -Wall -I$(INCDIR) -O2 -fvisibility=hidden
TARGET = mmp4m
.PHONY: shared test
all: shared test
shared: $(LIB_OBJS)
$(LINKER) -o lib$(TARGET).so -shared -O3 $(LIB_OBJS)
test: $(APP_OBJS) $(LIB_OBJS)
$(CC) -o $(TARGET) $(APP_OBJS) $(LIB_OBJS)
%.o : %.c
$(CC) $(CFLAGS) $(CPP_FLAG) -c $< -o $@
clean:
rm -f $(LIB_OBJS) $(APP_OBJS) *.a *.so *.o *~
rm -f lib$(TARGET).so $(TARGET)
pack:
$(MAKE) clean
rm -rf $(TARGET).tar.bz2
tar -cjvf $(TARGET).tar.bz2 Makefile inc src test