diff --git a/src/Makefile b/Makefile similarity index 91% rename from src/Makefile rename to Makefile index 823ac53..1f1f918 100644 --- a/src/Makefile +++ b/Makefile @@ -19,40 +19,40 @@ # along with this program. If not, see . # #=----------------------------------------------------------------------------=# -.DEFAULT_GOAL:= all -.PHONY: all clean -.PRECIOUS: %.c - CCOPTS=-pthread -fPIC -fwrapv -Wall -fno-strict-aliasing CCFLAGS=-I /usr/include/python3.9 LDFLAGS=-lpython3.9 -lpthread -lm -lutil -ldl -BINDIR=../bin - +BINDIR=bin +SRCDIR=src DYNLIBS= $(BINDIR)/scheduler.so $(BINDIR)/server.so $(BINDIR)/localthread.so +.DEFAULT_GOAL:= all +.PHONY: all clean +.PRECIOUS: $(SRCDIR)/%.c + # ---- General recipes ------------------------------------------------------- # -$(BINDIR)/%.so: %.c +$(BINDIR)/%.so: $(SRCDIR)/%.c @echo "Building dynamic library $@" @$(CC) --shared $(CCOPTS) $(CCFLAGS) -o $@ $< -%.c: %.py +$(SRCDIR)/%.c: $(SRCDIR)/%.py @echo "Cythonizing $< to $@" @cython3 -3 $< -o $@ # ---- Main recipe ----------------------------------------------------------- # -$(BINDIR)/gem-graph-server: main.c +$(BINDIR)/gem-graph-server: $(SRCDIR)/main.c @echo "Building program to $@" @$(CC) $(CCOPTS) -no-pie $(CCFLAGS) -o $@ $< $(LDFLAGS) @echo "Success!" -main.c: main.py +$(SRCDIR)/main.c: $(SRCDIR)/main.py @echo "Cythonizing main file to $@" @cython3 -3 $< -o $@ --embed # ---- Misc recipes ---------------------------------------------------------- # clean: - rm -rf *.c ../bin/* + rm -rf $(SRCDIR)/*.c $(BINDIR)/* all: $(DYNLIBS) $(BINDIR)/gem-graph-server