Improved intermediate *.c generation

This commit is contained in:
Adrien Bourmault 2021-04-10 23:02:40 +02:00
parent 17fdb7bed0
commit 4486026d23
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 10 additions and 7 deletions

View File

@ -19,8 +19,9 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # # along with this program. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=# #=----------------------------------------------------------------------------=#
.PHONY: all clean .DEFAULT_GOAL:= all
.DEFAULT_GOAL: all .PHONY: all dynlibs clean
.PRECIOUS: %.c
CCOPTS=-pthread -fPIC -fwrapv -Wall -fno-strict-aliasing CCOPTS=-pthread -fPIC -fwrapv -Wall -fno-strict-aliasing
CCFLAGS=-I /usr/include/python3.9 CCFLAGS=-I /usr/include/python3.9
@ -37,21 +38,23 @@ $(BINDIR)/%.so: %.c
%.c: %.py %.c: %.py
@echo "Cythonizing $< to $@" @echo "Cythonizing $< to $@"
@cython3 $< -o $@ @cython3 -3 $< -o $@
dynlibs: $(DYNLIBS)
# ---- Main recipe ----------------------------------------------------------- # # ---- Main recipe ----------------------------------------------------------- #
$(BINDIR)/gem-graph-server: main.c $(DYNLIBS) $(BINDIR)/gem-graph-server: main.c
@echo "Building program to $@" @echo "Building program to $@"
@$(CC) $(CCOPTS) -no-pie $(CCFLAGS) -o $@ $< $(LDFLAGS) @$(CC) $(CCOPTS) -no-pie $(CCFLAGS) -o $@ $< $(LDFLAGS)
@echo "Success!" @echo "Success!"
main.c: main.py main.c: main.py
@echo "Cythonizing main file to $@" @echo "Cythonizing main file to $@"
@cython3 $< -o $@ --embed @cython3 -3 $< -o $@ --embed
# ---- Misc recipes ---------------------------------------------------------- # # ---- Misc recipes ---------------------------------------------------------- #
clean: clean:
rm -rf *.c ../bin/* rm -rf *.c ../bin/*
all: $(BINDIR)/gem-graph-server all: dynlibs $(BINDIR)/gem-graph-server