-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.static
59 lines (46 loc) · 1.5 KB
/
Makefile.static
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
UNAME := $(shell uname)
TARGET=pltb.out
CC=gcc
ifeq ($(UNAME), Darwin)
LFLAGS_STATIC=-Wl,-Bstatic
LFLAGS_DYNAMIC=-Wl,-Bdynamic -lm
else
LFLAGS_STATIC=-Wl,-Bstatic
LFLAGS_DYNAMIC=-Wl,-Bdynamic -lm -lrt
endif
CFLAGS=-c -O3 -std=gnu99 -Wall -Wextra -Wredundant-decls -Wswitch-default \
-Wimport -Wno-int-to-pointer-cast -Wbad-function-cast \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-Wstrict-prototypes -Wformat-nonliteral -Wundef -DMPI_MASTER_WORKER=0
OBJECTS = $(patsubst src/%.c,src/%.o,$(filter-out $(wildcard src/mpi*.c),$(wildcard src/*.c)))
HEADERS = $(filter-out $(wildcard src/mpi*.h),$(wildcard src/*.h)))
.PHONY: default all clean
default: avx
clang: CC := clang
clang: CFLAGS += -Weverything -pedantic
clang: LFLAGS_STATIC += -l pll-avx
clang: $(TARGET)
avx: LFLAGS_STATIC += -l pll-avx
avx: $(TARGET)
avx-pthreads: LFLAGS_STATIC += -l pll-avx-pthreads
avx-pthreads: $(TARGET)
sse3: LFLAGS_STATIC += -l pll-sse3
sse3: $(TARGET)
sse3-pthreads: LFLAGS_STATIC += -l pll-sse3-pthreads
sse3-pthreads: $(TARGET)
debug: CFLAGS += -DDEBUG -g -O0
debug: CFLAGS := $(filter-out -O3,$(CFLAGS))
debug: LFLAGS_STATIC += -l pll-avx
debug: $(TARGET)
debug-sse3: CFLAGS += -DDEBUG -g -O0
debug-sse3: CFLAGS := $(filter-out -O3,$(CFLAGS))
debug-sse3: LFLAGS_STATIC += -l pll-sse3
debug-sse3: $(TARGET)
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(LFLAGS_STATIC) $(LFLAGS_DYNAMIC) -o $@
clean:
-rm -f src/*.o
-rm -f $(TARGET)