Commit 60fb5186 authored by Ophélie Gagnard's avatar Ophélie Gagnard

Improve cython's Makefile. Remove useless files.

parent 5fc7f057
ifeq (,)
INCLUDE_DIRS = -I/usr/include/python3.7
INCLUDE_PYTHON = $(shell pkg-config --cflags python3 | cut -f 1 -d " ")
else
......@@ -34,25 +34,14 @@ LDLIBS = -lcrypto -lfmt
EXT_SUFFIX := $(shell python3 -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
EXT = $(EXE)$(EXT_SUFFIX)
# Build with Python runtime
all: $(EXT)
$(EXT): setup.py
@echo "[Cython Compiling $^ -> $@]"
python3 setup.py build_ext --inplace
# Run with Python runtime
run: $(EXT)
python3 -c "import $(EXE); $(EXE).python_main()" 2>/dev/null
# Build without Python runtime
nopython: main.cpp#$(EXE)
all: main.cpp#$(EXE)
mkdir -p logs
# Error expected here, writing a C program using the error messages
-g++ -O2 -g -Wno-unused-result -Wsign-compare -pthread -I/opt/python-3.7.12/include/python3.7m/ main.cpp -lcrypto -lfmt -o main 2> logs/link_errors
-g++ -O2 -g -Wno-unused-result -Wsign-compare -pthread $(INCLUDE_PYTHON) main.cpp -lcrypto -lfmt -o main 2> logs/link_errors
./parse_link_errors.py < logs/link_errors
make fake_python.o
g++ -O2 -g -Wno-unused-result -Wsign-compare -pthread -I/opt/python-3.7.12/include/python3.7m/ main.cpp fake_python.o -lcrypto -lfmt -o metadata-collect-agent
g++ -O2 -g -Wno-unused-result -Wsign-compare -pthread $(INCLUDE_PYTHON) main.cpp fake_python.o -lcrypto -lfmt -o metadata-collect-agent
#-ln -f ../../metadata-collect-agent metadata-collect-agent
-ln -f metadata-collect-agent ../../dracut.module/90metadata-collect/metadata-collect-agent
#-ln -f metadata-collect-agent ../../debian.package.unsafe/unsafe-boot-metadata-collect-agent/sbin/metadata-collect-agent
......@@ -66,10 +55,6 @@ nopython: main.cpp#$(EXE)
@echo "[C++ Compiling $^ -> $@]"
$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@
# Run without Python runtime
runnopython: $(EXE)
./$(EXE) 2>/dev/null
clean:
-rm -f *.c *.cpp *.html
-rm -f *.h
......@@ -84,5 +69,5 @@ clean:
-rm -f ../../debian.package.unsafe/unsafe-boot-metadata-collect-agent/sbin/metadata-collect-agent
-rm -rf logs
.PHONY: all run nopython runnopython clean
.PHONY: all clean
.PRECIOUS: %.cpp
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment