blob: bb501b5694d61d546fe380eea1583d41f3e499af (
plain)
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
|
CC := clang
TARGET := main
SPIRES_DIR := ../spires
SOURCES := main.c spires_interface.c crossbar_generator.c read_crossbar.c
OBJECTS := $(SOURCES:.c=.o)
PLPLOT_LIBS := $(shell pkg-config --libs plplot)
CPPFLAGS := -I. -I$(SPIRES_DIR)/include
CFLAGS := -Wall -Wextra -Wpedantic -std=c11 -g -fopenmp
LDFLAGS := -L$(SPIRES_DIR)/lib -Wl,-rpath,'$$ORIGIN/../spires/lib'
LDLIBS := -lspires -lopenblas -llapacke -lm -fopenmp $(PLPLOT_LIBS)
PLPLOT_CFLAGS := $(shell pkg-config --cflags plplot)
CFLAGS += $(PLPLOT_CFLAGS)
.PHONY: all run clean debug
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $(TARGET)
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
run: $(TARGET)
LD_LIBRARY_PATH=$(SPIRES_DIR)/lib:$$LD_LIBRARY_PATH ./$(TARGET)
debug: CFLAGS += -fsanitize=address,undefined -fno-omit-frame-pointer
debug: LDFLAGS += -fsanitize=address,undefined
debug: clean $(TARGET)
clean:
rm -f $(OBJECTS) $(TARGET)
|