diff --git a/src/Makefile b/src/Makefile index 8dde44e..b9c1af3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,29 +20,38 @@ #=----------------------------------------------------------------------------=# .PHONY: all clean +.DEFAULT_GOAL: all CCOPTS=-pthread -fPIC -fwrapv -Wall -fno-strict-aliasing CCFLAGS=-I /usr/include/python3.9 LDFLAGS=-lpython3.9 -lpthread -lm -lutil -ldl +BINDIR=../bin -DEPS=main.c scheduler.c server.c localthread.c +DYNLIBS= $(BINDIR)/scheduler.so $(BINDIR)/server.so $(BINDIR)/localthread.so -gem-graph-server: $(DEPS) - $(CC) $(CCOPTS) $(CCFLAGS) -o $@ $(DEPS) $(LDFLAGS) +# ---- General recipes ------------------------------------------------------- # + +$(BINDIR)/%.so: %.c + @echo "Building dynamic library $@" + @$(CC) --shared $(CCOPTS) $(CCFLAGS) -o $@ $< %.c: %.py - cython3 $< -o $@ + @echo "Cythonizing $< to $@" + @cython3 $< -o $@ + +# ---- Main recipe ----------------------------------------------------------- # +$(BINDIR)/gem-graph-server: main.c $(DYNLIBS) + @echo "Building program to $@" + @$(CC) $(CCOPTS) $(CCFLAGS) -o $@ $< $(LDFLAGS) + @echo "Success!" main.c: main.py - cython3 $< -o $@ --embed + @echo "Cythonizing main file to $@" + @cython3 $< -o $@ --embed + +# ---- Misc recipes ---------------------------------------------------------- # clean: - rm -rf *.c *.o gem-graph-server test + rm -rf *.c ../bin/* -all: gem-graph-server - -test: test.c - $(CC) $(CCOPTS) $(CCFLAGS) -o $@ $< $(LDFLAGS) - -test.c: test.py - cython3 $< --embed +all: $(BINDIR)/gem-graph-server diff --git a/src/gem-graph-server b/src/gem-graph-server deleted file mode 100755 index e639b3a..0000000 Binary files a/src/gem-graph-server and /dev/null differ