Switching to C
This commit is contained in:
parent
6540aeadd2
commit
4f6448a2ba
44
Makefile
44
Makefile
|
@ -19,40 +19,42 @@
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||||
#=----------------------------------------------------------------------------=#
|
#=----------------------------------------------------------------------------=#
|
||||||
|
|
||||||
CCOPTS=-pthread -fPIC -fwrapv -Wall -fno-strict-aliasing
|
CCINCLUDES=-Iinclude
|
||||||
CCFLAGS=-I /usr/include/python3.9
|
CCOPTS=-pthread -Wall
|
||||||
LDFLAGS=-lpython3.9 -lpthread -lm -lutil -ldl
|
LDFLAGS= -lc -lpthread
|
||||||
BINDIR=bin
|
BINDIR=bin
|
||||||
SRCDIR=src
|
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
|
.DEFAULT_GOAL:= all
|
||||||
.PHONY: all clean
|
.PHONY: all clean deb
|
||||||
.PRECIOUS: $(SRCDIR)/%.c
|
|
||||||
|
|
||||||
# ---- General recipes ------------------------------------------------------- #
|
# ---- General recipes ------------------------------------------------------- #
|
||||||
|
|
||||||
$(BINDIR)/%.so: $(SRCDIR)/%.c
|
$(BINDIR)/%.o: $(SRCDIR)/%.c
|
||||||
@echo "Building dynamic library $@"
|
@echo "Compiling $<"
|
||||||
@$(CC) --shared $(CCOPTS) $(CCFLAGS) -o $@ $<
|
@$(CC) $(CCINCLUDES) $(CCOPTS) $(CCFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(SRCDIR)/%.c: $(SRCDIR)/%.py
|
|
||||||
@echo "Cythonizing $< to $@"
|
|
||||||
@cython3 -3 $< -o $@
|
|
||||||
|
|
||||||
# ---- Main recipe ----------------------------------------------------------- #
|
# ---- Main recipe ----------------------------------------------------------- #
|
||||||
$(BINDIR)/gem-graph-server: $(SRCDIR)/main.c
|
$(BINDIR)/gem-graph-server: $(OBJ)
|
||||||
@echo "Building program to $@"
|
@echo "Building program to $@"
|
||||||
@$(CC) $(CCOPTS) -no-pie $(CCFLAGS) -o $@ $< $(LDFLAGS)
|
@$(CC) -o $@ $(OBJ) $(LDFLAGS)
|
||||||
@echo "Success!"
|
@echo "Success!"
|
||||||
|
|
||||||
$(SRCDIR)/main.c: $(SRCDIR)/main.py
|
|
||||||
@echo "Cythonizing main file to $@"
|
|
||||||
@cython3 -3 $< -o $@ --embed
|
|
||||||
|
|
||||||
|
|
||||||
# ---- Misc recipes ---------------------------------------------------------- #
|
# ---- Misc recipes ---------------------------------------------------------- #
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(SRCDIR)/*.c $(BINDIR)/*
|
rm -rf $(SRCDIR)/*.o $(BINDIR)/* *.deb
|
||||||
|
|
||||||
all: $(DYNLIBS) $(BINDIR)/gem-graph-server
|
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
|
||||||
|
|
|
@ -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
|
|
@ -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 <https://www.gnu.org/licenses/>. //
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
struct {
|
||||||
|
size_t size;
|
||||||
|
bool *space;
|
||||||
|
} typedef BoolArray_t;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
size_t size;
|
||||||
|
int *space;
|
||||||
|
} typedef IntArray_t;
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue