forked from ridiculousfish/libdivide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·70 lines (54 loc) · 1.59 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
UNAME := $(shell uname)
UNAME_P := $(shell uname -p)
# Defaults
CC = cc
CPP = c++
ARCH_386 =
ARCH_x64 =
ARCH_FLAGS =
LINKFLAGS =
# Mac OS X
ifeq ($(UNAME),Darwin)
CC = clang
endif
# Linux
ifeq ($(UNAME),Linux)
LINKFLAGS = -pthread
endif
# SSE
ifeq ($(UNAME_P),i386)
ARCH_386 = -arch i386
ARCH_x64 = -arch x86_64
ARCH_FLAGS = -msse2 -DLIBDIVIDE_USE_SSE2=1
endif
ifeq ($(UNAME_P),x86_64)
ARCH_386 = -arch i386
ARCH_x64 = -arch x86_64
ARCH_FLAGS = -msse2 -DLIBDIVIDE_USE_SSE2=1
endif
ifeq ($(UNAME_P),amd64)
ARCH_386 = -arch i386
ARCH_x64 = -arch x86_64
ARCH_FLAGS = -msse2 -DLIBDIVIDE_USE_SSE2=1
endif
# NEON
ifeq ($(UNAME_P),armv7l)
ARCH_FLAGS = -mfpu=neon -DLIBDIVIDE_USE_NEON=1
endif
DEBUG_FLAGS = -fstrict-aliasing -W -Wall -g -O0 -DLIBDIVIDE_ASSERTIONS_ON=1 $(ARCH_FLAGS) $(LINKFLAGS)
RELEASE_FLAGS = -fstrict-aliasing -W -Wall -g -O3 $(ARCH_FLAGS) $(LINKFLAGS)
tester: debug
debug: libdivide_test.cpp libdivide.h
$(CPP) $(DEBUG_FLAGS) $(ARCH_386) $(ARCH_x64) -g -o tester libdivide_test.cpp
i386: libdivide_test.cpp libdivide.h
$(CPP) $(DEBUG_FLAGS) $(ARCH_386) -o tester libdivide_test.cpp
x86_64: libdivide_test.cpp libdivide.h
$(CPP) $(DEBUG_FLAGS) $(ARCH_x64) -o tester libdivide_test.cpp
release: libdivide_test.cpp libdivide.h
$(CPP) $(RELEASE_FLAGS) $(ARCH_x64) $(ARCH_386) -o tester libdivide_test.cpp
benchmark: libdivide_benchmark.c libdivide.h
$(CC) $(RELEASE_FLAGS) $(ARCH_x64) $(ARCH_386) -o benchmark libdivide_benchmark.c
clean:
rm -Rf tester tester.dSYM benchmark benchmark.dSYM
install:
@echo "libdivide does not install! Just copy the header libdivide.h into your projects."