-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
executable file
·145 lines (109 loc) · 3.94 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
#
# Makefile for Silk SDK
#
# Copyright (c) 2009, Skype Limited
# All rights reserved.
#
#Platform detection and settings
BUILD_OS := $(shell uname | sed -e 's/^.*Darwin.*/MacOS-X/ ; s/^.*CYGWIN.*/Windows/')
BUILD_ARCHITECTURE := $(shell uname -m | sed -e 's/i686/i386/')
EXESUFFIX =
LIBPREFIX = lib
LIBSUFFIX = .a
OBJSUFFIX = .o
# sudo xcode-select -switch /Developer
# sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# IPHONE_SDK = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
IPHONE_SDK = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
CFLAGS += -g -arch armv7 -mthumb -isysroot ${IPHONE_SDK}
LDFLAGS += -Wl,-no_pie -arch armv7 -mthumb -isysroot ${IPHONE_SDK}
USE_NEON=yes
# CC = `xcrun -sdk ${IPHONE_SDK} -find gcc-4.2`
# CXX = `xcrun -sdk ${IPHONE_SDK} -find g++-4.2`
CC = `xcrun -sdk ${IPHONE_SDK} -find clang`
CXX = `xcrun -sdk ${IPHONE_SDK} -find clang++`
AR = `xcrun -sdk ${IPHONE_SDK} -find ar`
RANLIB = `xcrun -sdk ${IPHONE_SDK} -find ranlib`
CP = $(TOOLCHAIN_PREFIX)cp
cppflags-from-defines = $(addprefix -D,$(1))
cppflags-from-includes = $(addprefix -I,$(1))
ldflags-from-ldlibdirs = $(addprefix -L,$(1))
ldlibs-from-libs = $(addprefix -l,$(1))
ifneq (,$(TARGET_CPU))
CFLAGS += -mcpu=$(TARGET_CPU)
ifneq (,$(TARGET_TUNE))
CFLAGS += -mtune=$(TARGET_TUNE)
else
CFLAGS += -mtune=$(TARGET_CPU)
endif
endif
ifneq (,$(TARGET_FPU))
CFLAGS += -mfpu=$(TARGET_FPU)
endif
ifneq (,$(TARGET_ARCH))
CFLAGS += -march=$(TARGET_ARCH)
endif
# Helper to make NEON testing easier, when using USE_NEON=yes do not set TARGET_CPU or TARGET_FPU
ifeq (yes,$(USE_NEON))
CFLAGS += -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon
endif
CFLAGS += -Wall -enable-threads -O3
CFLAGS += $(call cppflags-from-defines,$(CDEFINES))
CFLAGS += $(call cppflags-from-defines,$(ADDED_DEFINES))
CFLAGS += $(call cppflags-from-includes,$(CINCLUDES))
LDFLAGS += $(call ldflags-from-ldlibdirs,$(LDLIBDIRS))
LDLIBS += $(call ldlibs-from-libs,$(LIBS))
COMPILE.c.cmdline = $(CC) -c $(CFLAGS) $(ADDED_CFLAGS) -o $@ $<
COMPILE.S.cmdline = $(CC) -c $(CFLAGS) $(ADDED_CFLAGS) -o $@ $<
COMPILE.cpp.cmdline = $(CXX) -c $(CFLAGS) $(ADDED_CFLAGS) -o $@ $<
LINK.o = $(CXX) $(LDPREFLAGS) $(LDFLAGS)
LINK.o.cmdline = $(LINK.o) $^ $(LDLIBS) -o $@$(EXESUFFIX)
ARCHIVE.cmdline = $(AR) $(ARFLAGS) $@ $^ && $(RANLIB) $@
%$(OBJSUFFIX):%.c
$(COMPILE.c.cmdline)
%$(OBJSUFFIX):%.cpp
$(COMPILE.cpp.cmdline)
%$(OBJSUFFIX):%.S
$(COMPILE.S.cmdline)
# Directives
CINCLUDES += interface src test
# VPATH e.g. VPATH = src:../headers
VPATH = ./ \
interface \
src \
test
# Variable definitions
LIB_NAME = SKP_SILK_SDK
TARGET = $(LIBPREFIX)$(LIB_NAME)$(LIBSUFFIX)
SRCS_C = $(wildcard src/*.c)
#ifneq (,$(TOOLCHAIN_PREFIX))
SRCS_S = $(wildcard src/*.S)
OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SRCS_C)) $(patsubst %.S,%$(OBJSUFFIX),$(SRCS_S))
#else
# OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SRCS_C))
#endif
ENCODER_SRCS_C = test/Encoder.c
ENCODER_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(ENCODER_SRCS_C))
DECODER_SRCS_C = test/Decoder.c
DECODER_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(DECODER_SRCS_C))
SIGNALCMP_SRCS_C = test/signalCompare.c
SIGNALCMP_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SIGNALCMP_SRCS_C))
LIBS = \
$(LIB_NAME)
LDLIBDIRS = ./
# Rules
default: all
all: $(TARGET) encoder decoder signalcompare
lib: $(TARGET)
$(TARGET): $(OBJS)
$(ARCHIVE.cmdline)
encoder$(EXESUFFIX): $(ENCODER_OBJS)
$(LINK.o.cmdline)
decoder$(EXESUFFIX): $(DECODER_OBJS)
$(LINK.o.cmdline)
signalcompare$(EXESUFFIX): $(SIGNALCMP_OBJS)
$(LINK.o.cmdline)
clean:
$(RM) $(TARGET)* $(OBJS) $(ENCODER_OBJS) $(DECODER_OBJS) \
$(SIGNALCMP_OBJS) $(TEST_OBJS) \
encoder$(EXESUFFIX) decoder$(EXESUFFIX) signalcompare$(EXESUFFIX)