-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile.core
36 lines (26 loc) · 1.57 KB
/
Makefile.core
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
# load architecture-dependent optimization flags, the default is `-march=native'
ARCH = NATIVE
NATIVE_FLAGS = $(shell bash -c "if [[ $(CC) = icc* ]]; then echo '-march=native' ; else echo '-march=native'; fi")
SSE41_FLAGS = $(shell bash -c "if [[ $(CC) = icc* ]]; then echo '-msse4.2'; else echo '-msse4.2 -mpopcnt'; fi")
AVX2_FLAGS = $(shell bash -c "if [[ $(CC) = icc* ]]; then echo '-march=core-avx2'; else echo '-mavx2 -mbmi -mbmi2 -mlzcnt -mpopcnt'; fi")
ARCHFLAGS = $($(ARCH)_FLAGS)
# add suffix if namespace is specified
SUFFIX = $(NAMESPACE:$(NAMESPACE)=.$(NAMESPACE))
SUFFIXFLAGS = $(NAMESPACE:$(NAMESPACE)=-DNAMESPACE=$(NAMESPACE))
# compose flags
CFLAGS_NOWARN = $(shell bash -c "if [[ $(CC) = icc* ]]; then echo '-Wno-unused-variable'; else echo '-Wno-unused-variable -Wno-unused-label'; fi")
CFLAGS_INTL = $(CFLAGS) $(CFLAGS_NOWARN) $(ARCHFLAGS) $(SUFFIXFLAGS)
# expand objects
MINIALIGN_OBJS = minialign$(SUFFIX).o
GABA_OBJS = $(shell bash -c "echo gaba.{linear,affine,combined}.{16,32,64}$(SUFFIX).o")
all: $(MINIALIGN_OBJS) $(GABA_OBJS)
$(MINIALIGN_OBJS): minialign.c
$(CC) -c -o $@ $(CFLAGS_INTL) $<
$(GABA_OBJS): gaba.c
$(CC) -c -o $@ $(CFLAGS_INTL) -DMODEL=`echo $@ | cut -d'.' -f2 | tr a-z A-Z` -DBW=`echo $@ | cut -d'.' -f3` -DSUFFIX -DBIT=2 $<
nowrap: minialign.c gaba.c
$(CC) -c -o minialign.o $(CFLAGS_INTL) -DGABA_NOWRAP minialign.c
$(CC) -c -o gaba.o $(CFLAGS_INTL) -DMODEL=COMBINED -DBW=64 -DBIT=2 gaba.c
gaba.c: gaba.h log.h unittest.h sassert.h
minialign.c: kvec.h ksort.h gaba_wrap.h gaba.h lmm.h unittest.h sassert.h
gaba_wrap.h: gaba.h log.h unittest.h sassert.h