Makefile at toplevel

This commit is contained in:
Adrien Bourmault 2021-06-08 18:05:32 +02:00
parent f35f7659a0
commit 6540aeadd2
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 11 additions and 11 deletions

View File

@ -19,40 +19,40 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
.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