-
Notifications
You must be signed in to change notification settings - Fork 48
/
Makefile
156 lines (117 loc) · 3.27 KB
/
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#
# Makefile
#
# Copyright (C) 2010 Creytiv.com
#
# Master version number
VER_MAJOR := 0
VER_MINOR := 6
VER_PATCH := 0
PROJECT := rem
VERSION := $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
OPT_SPEED := 1
LIBRE_MK := $(shell [ -f ../re/mk/re.mk ] && \
echo "../re/mk/re.mk")
ifeq ($(LIBRE_MK),)
LIBRE_MK := $(shell [ -f /usr/share/re/re.mk ] && \
echo "/usr/share/re/re.mk")
endif
ifeq ($(LIBRE_MK),)
LIBRE_MK := $(shell [ -f /usr/local/share/re/re.mk ] && \
echo "/usr/local/share/re/re.mk")
endif
include $(LIBRE_MK)
# List of modules
MODULES += fir goertzel
MODULES += g711
MODULES += aubuf aufile auresamp autone dtmf
MODULES += au auconv
ifneq ($(HAVE_LIBPTHREAD),)
MODULES += aumix vidmix
endif
MODULES += vid vidconv
MODULES += aac
MODULES += avc
MODULES += h264
LIBS += -lm
INSTALL := install
ifeq ($(DESTDIR),)
PREFIX := /usr/local
else
PREFIX := /usr
endif
ifeq ($(LIBDIR),)
LIBDIR := $(PREFIX)/lib
endif
INCDIR := $(PREFIX)/include/rem
CFLAGS += -I$(LIBRE_INC) -Iinclude
# XXX
ifneq ($(HAVE_ARMV6),)
CFLAGS += -DHAVE_ARMV6=1
endif
ifneq ($(HAVE_NEON),)
CFLAGS += -DHAVE_NEON=1
endif
MODMKS := $(patsubst %,src/%/mod.mk,$(MODULES))
SHARED := librem$(LIB_SUFFIX)
STATIC := librem.a
include $(MODMKS)
OBJS ?= $(patsubst %.c,$(BUILD)/%.o,$(filter %.c,$(SRCS)))
OBJS += $(patsubst %.S,$(BUILD)/%.o,$(filter %.S,$(SRCS)))
all: $(SHARED) $(STATIC)
-include $(OBJS:.o=.d)
$(SHARED): $(OBJS)
@echo " LD $@"
@$(LD) $(LFLAGS) $(SH_LFLAGS) $^ -L$(LIBRE_SO) -lre $(LIBS) -o $@
$(STATIC): $(OBJS)
@echo " AR $@"
@$(AR) $(AFLAGS) $@ $^
ifneq ($(RANLIB),)
@$(RANLIB) $@
endif
librem.pc:
@echo 'prefix='$(PREFIX) > librem.pc
@echo 'exec_prefix=$${prefix}' >> librem.pc
@echo 'libdir=$${prefix}/lib' >> librem.pc
@echo 'includedir=$${prefix}/include/rem' >> librem.pc
@echo '' >> librem.pc
@echo 'Name: librem' >> librem.pc
@echo 'Description: Audio and video processing media library' \
>> librem.pc
@echo 'Version: '$(VERSION) >> librem.pc
@echo 'URL: http://creytiv.com/rem.html' >> librem.pc
@echo 'Libs: -L$${libdir} -lrem -lre' >> librem.pc
@echo 'Cflags: -I$${includedir}' >> librem.pc
$(BUILD)/%.o: src/%.c $(BUILD) Makefile $(MK) $(MODMKS)
@echo " CC $@"
@$(CC) $(CFLAGS) -c $< -o $@ $(DFLAGS)
$(BUILD)/%.o: src/%.S $(BUILD) Makefile $(MK) $(MODMKS)
@echo " AS $@"
@$(CC) $(CFLAGS) -c $< -o $@ $(DFLAGS)
$(BUILD): Makefile $(MK) $(MODMKS)
@mkdir -p $(patsubst %,$(BUILD)/%,$(sort $(dir $(SRCS))))
@touch $@
.PHONY: clean
clean:
@rm -rf $(SHARED) $(STATIC) librem.pc test.d test.o test $(BUILD)
install: $(SHARED) $(STATIC) librem.pc
@mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(LIBDIR)/pkgconfig \
$(DESTDIR)$(INCDIR)
$(INSTALL) -m 0644 $(shell find include -name "*.h") \
$(DESTDIR)$(INCDIR)
$(INSTALL) -m 0755 $(SHARED) $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 0755 $(STATIC) $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 0644 librem.pc $(DESTDIR)$(LIBDIR)/pkgconfig
.PHONY: uninstall
uninstall:
@rm -rf $(DESTDIR)$(INCDIR)
@rm -f $(DESTDIR)$(LIBDIR)/$(SHARED)
@rm -f $(DESTDIR)$(LIBDIR)/$(STATIC)
@rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/librem.pc
-include test.d
test.o: test.c
@echo " CC $@"
@$(CC) $(CFLAGS) -c $< -o $@ $(DFLAGS)
test$(BIN_SUFFIX): test.o $(SHARED) $(STATIC)
@echo " LD $@"
@$(LD) $(LFLAGS) $< -L. -lrem -lre $(LIBS) -o $@