Makefile at toplevel
This commit is contained in:
parent
f35f7659a0
commit
6540aeadd2
|
@ -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
|
Loading…
Reference in New Issue