61 lines
2.7 KiB
Makefile
61 lines
2.7 KiB
Makefile
#=----------------------------------------------------------------------------=#
|
|
# Makefile #
|
|
# #
|
|
# 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/>. #
|
|
#=----------------------------------------------------------------------------=#
|
|
|
|
CCINCLUDES=-Iinclude
|
|
CCOPTS=-pthread -Wall
|
|
LDFLAGS= -lc -lpthread
|
|
BINDIR=bin
|
|
SRCDIR=src
|
|
DEBDIR=debian
|
|
OBJ=$(BINDIR)/scheduler.o $(BINDIR)/server.o $(BINDIR)/localthread.o $(BINDIR)/main.o
|
|
|
|
.DEFAULT_GOAL:= all
|
|
.PHONY: all clean deb
|
|
|
|
# ---- General recipes ------------------------------------------------------- #
|
|
|
|
$(BINDIR)/%.o: $(SRCDIR)/%.c
|
|
@echo "Compiling $<"
|
|
@$(CC) $(CCINCLUDES) $(CCOPTS) $(CCFLAGS) -c -o $@ $<
|
|
|
|
# ---- Main recipe ----------------------------------------------------------- #
|
|
$(BINDIR)/gem-graph-server: $(OBJ)
|
|
@echo "Building program to $@"
|
|
@$(CC) -o $@ $(OBJ) $(LDFLAGS)
|
|
@echo "Success!"
|
|
|
|
# ---- Misc recipes ---------------------------------------------------------- #
|
|
clean:
|
|
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
|