summaryrefslogtreecommitdiff
path: root/src/makefile
diff options
context:
space:
mode:
authorYour Name <[email protected]>2026-07-21 10:20:48 -0700
committerYour Name <[email protected]>2026-07-21 10:20:48 -0700
commita4edd40c35e2784691936662a8a89463cc434f9a (patch)
tree474ec971d6fa6be4c512757c54b589ab32edbdec /src/makefile
parentc7e2e6e8edb1536135e4cb6d307d5817e73b3bae (diff)
Spires feeding into SPICE crossbar
Diffstat (limited to 'src/makefile')
-rw-r--r--src/makefile37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/makefile b/src/makefile
new file mode 100644
index 0000000..85eaaba
--- /dev/null
+++ b/src/makefile
@@ -0,0 +1,37 @@
+CC := clang
+
+TARGET := spires_interface_test
+SPIRES_DIR := ../spires
+
+SOURCES := spires_interface_test.c spires_interface.c crossbar_generator.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)