]> WPIA git - cassiopeia.git/commitdiff
add: Initial build system to create binaries from our source
authorBenny Baumann <BenBE@geshi.org>
Thu, 4 Sep 2014 15:10:39 +0000 (17:10 +0200)
committerBenny Baumann <BenBE@geshi.org>
Fri, 7 Nov 2014 22:51:11 +0000 (23:51 +0100)
Makefile [new file with mode: 0644]
debian/cassiopeia.install [new file with mode: 0644]
debian/control
lib/collissiondetect/Makefile [new file with mode: 0644]
lib/openssl/Makefile [new file with mode: 0644]
test/Makefile [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..6c98274
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,112 @@
+INSTALL = ${shell which install}
+INSTALL_FILE    = $(INSTALL) -p -D -o root -g root  -m  644
+INSTALL_PROGRAM = $(INSTALL) -p -D -o root -g root  -m  700
+INSTALL_SCRIPT  = $(INSTALL) -p -D -o root -g root  -m  700
+INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
+
+MKDIR = mkdir -p
+
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+    CFLAGS += -O0
+else
+    CFLAGS += -O2
+endif
+ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
+    INSTALL_PROGRAM += -s
+endif
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    MAKEFLAGS += -j$(NUMJOBS)
+endif
+
+BIN="bin/cassiopeia"
+LIBS=openssl collissiondetect
+
+LT_CC=libtool --mode=compile gcc
+LT_CC_DEP=g++
+LT_CXX=libtool --mode=compile g++
+LT_CXX_DEP=g++
+LT_LD=libtool --mode=link g++
+
+CC=${LT_CC}
+CC_DEP=${LT_CC_DEP}
+CXX=${LT_CXX}
+CXX_DEP=${LT_CXX_DEP}
+LD=${LT_LD}
+
+CFLAGS=-O3 -g -flto -Wall -Werror -Wextra -pedantic -std=c++11
+CXXFLAGS=$(CFLAGS)
+LDFLAGS=-O3 -g -flto
+
+SRC_DIR=src
+OBJ_DIR=obj
+DEP_DIR=dep
+
+FS_SRC=$(wildcard ${SRC_DIR}/*.cpp)
+FS_BIN=$(wildcard ${SRC_DIR}/app/*.cpp)
+FS_LIBS=$(wildcard lib/*/)
+FS_OBJ=$(FS_SRC:${SRC_DIR}/%.cpp=${OBJ_DIR}/%.lo)
+FS_DEP=$(FS_SRC:${SRC_DIR}/%.cpp=${DEP_DIR}/%.d)
+
+.SUFFIXES: .c .cpp .d
+
+.PHONY: all
+all: build
+
+.PHONY: clean
+clean::
+       -rm -rf .libs
+       -rm -rf *.a
+       -rm -rf *.d
+       -rm -rf *.o
+       -rm -rf *.la
+       -rm -rf *.lo
+       -rm -rf *.so
+       -rm -rf ${OBJ_DIR}
+       -rm -rf ${DEP_DIR}
+       ${MAKE} -C lib/openssl clean
+       ${MAKE} -C lib/collissiondetect clean
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+       # Code to run the package test suite.
+       ${MAKE} -C test clean
+endif
+
+
+build: cassiopeia
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+       ${MAKE} -C test
+endif
+
+.PHONY: install
+install: build
+       ${INSTALL_PROGRAM} bin/cassiopeia ${DESTDIR}/usr/bin/cassiopeia
+
+.PHONY: libs
+libs: ${LIBS}
+
+.PHONY: openssl
+openssl:
+       ${MAKE} -C lib/openssl
+
+.PHONY: collissiondetect
+collissiondetect:
+       ${MAKE} -C lib/collissiondetect
+
+# --------
+
+cassiopeia: bin/cassiopeia
+
+bin/cassiopeia: libs ${FS_OBJ}
+       ${MKDIR} $(shell dirname $@) && ${LT_LD} -o $@ ${FS_OBJ}
+
+${DEP_DIR}/%.d: ${SRC_DIR}/%.cpp
+       ${MKDIR} $(shell dirname $@) && $(CXX_DEP) $(CXXFLAGS) -M -MF $@ $<
+${DEP_DIR}/%.d: ${SRC_DIR}/%.c
+       ${MKDIR} $(shell dirname $@) && $(CC) $(CXXFLAGS) -M -MF $@ $<
+
+${OBJ_DIR}/%.lo ${OBJ_DIR}/%.o: ${SRC_DIR}/%.c ${DEP_DIR}/%.d
+       ${MKDIR} $(shell dirname $@) && $(CC) $(CFLAGS) -o $@ -c $<
+${OBJ_DIR}/%.lo ${OBJ_DIR}/%.o: ${SRC_DIR}/%.cpp ${DEP_DIR}/%.d
+       ${MKDIR} $(shell dirname $@) && $(CXX) $(CXXFLAGS) -o $@ -c $<
+
+-include $(FS_DEP)
diff --git a/debian/cassiopeia.install b/debian/cassiopeia.install
new file mode 100644 (file)
index 0000000..85d1e46
--- /dev/null
@@ -0,0 +1 @@
+/usr/bin/cassiopeia
index 0e40186092af6eeb12effc77193bb607b055d7c6..493d9207b295cc7a43937d8e2455627ccf4256d9 100644 (file)
@@ -2,7 +2,7 @@ Source: cassiopeia
 Section: unknown
 Priority: extra
 Maintainer: CAcert Software Team <cacert-devel@cacert.org>
-Build-Depends: debhelper (>= 8.0.0)
+Build-Depends: debhelper (>= 8.0.0), libtool
 Standards-Version: 3.9.4
 Homepage: https://cacert.org/
 #Vcs-Git: git://git.debian.org/collab-maint/cassiopeia.git
diff --git a/lib/collissiondetect/Makefile b/lib/collissiondetect/Makefile
new file mode 100644 (file)
index 0000000..486754b
--- /dev/null
@@ -0,0 +1,7 @@
+.PHONY: all
+all:
+       @echo "Building Collission Detection library ..."
+
+.PHONY: clean
+clean:
+       @echo "Cleaning Collission Detection library ..."
diff --git a/lib/openssl/Makefile b/lib/openssl/Makefile
new file mode 100644 (file)
index 0000000..527c483
--- /dev/null
@@ -0,0 +1,7 @@
+.PHONY: all
+all:
+       @echo "Building Wide Open SSL ..."
+
+.PHONY: clean
+clean:
+       @echo "Flensing Wide Open SSL ..."
diff --git a/test/Makefile b/test/Makefile
new file mode 100644 (file)
index 0000000..4618c42
--- /dev/null
@@ -0,0 +1,7 @@
+.PHONY: all
+all:
+       @echo 'Performing some important tests ...'
+
+.PHONY: clean
+clean:
+       @echo 'Cleaning up behind us ...'