diff --git a/Makefile b/Makefile index 1f1f918..f955db5 100644 --- a/Makefile +++ b/Makefile @@ -19,40 +19,42 @@ # along with this program. If not, see . # #=----------------------------------------------------------------------------=# -CCOPTS=-pthread -fPIC -fwrapv -Wall -fno-strict-aliasing -CCFLAGS=-I /usr/include/python3.9 -LDFLAGS=-lpython3.9 -lpthread -lm -lutil -ldl +CCINCLUDES=-Iinclude +CCOPTS=-pthread -Wall +LDFLAGS= -lc -lpthread BINDIR=bin SRCDIR=src -DYNLIBS= $(BINDIR)/scheduler.so $(BINDIR)/server.so $(BINDIR)/localthread.so +DEBDIR=debian +OBJ=$(BINDIR)/scheduler.o $(BINDIR)/server.o $(BINDIR)/localthread.o $(BINDIR)/main.o .DEFAULT_GOAL:= all -.PHONY: all clean -.PRECIOUS: $(SRCDIR)/%.c +.PHONY: all clean deb # ---- General recipes ------------------------------------------------------- # -$(BINDIR)/%.so: $(SRCDIR)/%.c - @echo "Building dynamic library $@" - @$(CC) --shared $(CCOPTS) $(CCFLAGS) -o $@ $< - -$(SRCDIR)/%.c: $(SRCDIR)/%.py - @echo "Cythonizing $< to $@" - @cython3 -3 $< -o $@ +$(BINDIR)/%.o: $(SRCDIR)/%.c + @echo "Compiling $<" + @$(CC) $(CCINCLUDES) $(CCOPTS) $(CCFLAGS) -c -o $@ $< # ---- Main recipe ----------------------------------------------------------- # -$(BINDIR)/gem-graph-server: $(SRCDIR)/main.c +$(BINDIR)/gem-graph-server: $(OBJ) @echo "Building program to $@" - @$(CC) $(CCOPTS) -no-pie $(CCFLAGS) -o $@ $< $(LDFLAGS) + @$(CC) -o $@ $(OBJ) $(LDFLAGS) @echo "Success!" -$(SRCDIR)/main.c: $(SRCDIR)/main.py - @echo "Cythonizing main file to $@" - @cython3 -3 $< -o $@ --embed - - # ---- Misc recipes ---------------------------------------------------------- # clean: - rm -rf $(SRCDIR)/*.c $(BINDIR)/* + rm -rf $(SRCDIR)/*.o $(BINDIR)/* *.deb all: $(DYNLIBS) $(BINDIR)/gem-graph-server + +# ---- Build debian package -------------------------------------------------- # +$(BINDIR)/gem-graph-server.deb: all + mkdir -p gem-graph-server/usr/bin + mkdir -p gem-graph-server/DEBIAN + cp $(DEBDIR)/Manifest gem-graph-server/DEBIAN/control + cp $(BINDIR)/* gem-graph-server/usr/bin + dpkg-deb --build gem-graph-server + rm -rf gem-graph-server + +deb: $(BINDIR)/gem-graph-server.deb diff --git a/debian/Manifest b/debian/Manifest new file mode 100644 index 0000000..27314c1 --- /dev/null +++ b/debian/Manifest @@ -0,0 +1,9 @@ +Package: gem-graph-server +Version: 0.0.1 +Section: custom +Priority: optional +Architecture: amd64 +Essential: no +Installed-Size: 1049 +Maintainer: The Gem-graph Project +Description: The gem-graph computation server diff --git a/src/test.py b/include/localthread.h similarity index 100% rename from src/test.py rename to include/localthread.h diff --git a/include/scheduler.h b/include/scheduler.h new file mode 100644 index 0000000..e69de29 diff --git a/include/server.h b/include/server.h new file mode 100644 index 0000000..e69de29 diff --git a/include/types.h b/include/types.h new file mode 100644 index 0000000..960b71d --- /dev/null +++ b/include/types.h @@ -0,0 +1,32 @@ +//=-------------------------------------------------------------------------=// +// Main // +// // +// Copyright © 2021 The Gem-graph Project // +// // +// This file is part of gem-graph. // +// // +// This program is free software: you can redistribute it and/or modify // +// it under the terms of the GNU Affero General Public License as // +// published by the Free Software Foundation, either version 3 of the // +// License, or (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU Affero General Public License for more details. // +// // +// You should have received a copy of the GNU Affero General Public License // +// along with this program. If not, see . // +//=-------------------------------------------------------------------------=// + +#include + +struct { + size_t size; + bool *space; +} typedef BoolArray_t; + +struct { + size_t size; + int *space; +} typedef IntArray_t; diff --git a/src/localthread.py b/oldsrc/localthread.py similarity index 100% rename from src/localthread.py rename to oldsrc/localthread.py diff --git a/src/main.py b/oldsrc/main.py similarity index 100% rename from src/main.py rename to oldsrc/main.py diff --git a/src/scheduler.py b/oldsrc/scheduler.py similarity index 100% rename from src/scheduler.py rename to oldsrc/scheduler.py diff --git a/src/server.py b/oldsrc/server.py similarity index 100% rename from src/server.py rename to oldsrc/server.py diff --git a/oldsrc/test.py b/oldsrc/test.py new file mode 100644 index 0000000..e69de29 diff --git a/src/__pycache__/localthread.cpython-39.pyc b/src/__pycache__/localthread.cpython-39.pyc deleted file mode 100644 index 9f20a74..0000000 Binary files a/src/__pycache__/localthread.cpython-39.pyc and /dev/null differ diff --git a/src/__pycache__/scheduler.cpython-39.pyc b/src/__pycache__/scheduler.cpython-39.pyc deleted file mode 100644 index 41ed38d..0000000 Binary files a/src/__pycache__/scheduler.cpython-39.pyc and /dev/null differ diff --git a/src/__pycache__/server.cpython-39.pyc b/src/__pycache__/server.cpython-39.pyc deleted file mode 100644 index 4e7eb19..0000000 Binary files a/src/__pycache__/server.cpython-39.pyc and /dev/null differ