Better separate compilation
This commit is contained in:
parent
9f57a59f18
commit
ab780ea237
35
src/Makefile
35
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
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue