summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-11-21 16:49:31 +0100
committerRoland Reichwein <mail@reichwein.it>2020-11-21 16:49:31 +0100
commit7fd9bbf4ea1ba5ea1b30e9ba3039195ab40c246a (patch)
tree12c594d7e31caaa31ae48e1bfc9b66c9003db2c2 /Makefile
parent7edbd99775416a32c88acf8e9379518436905f02 (diff)
Added debian packaging
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 46 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 5247017..b219b40 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
PROJECTNAME=minicc
+VERSION=$(shell dpkg-parsechangelog --show-field Version)
+DISTROS=base #debian10 ubuntu2004 ubuntu2010
+
CXX=clang++-11
#CXX=g++-10
@@ -9,6 +12,8 @@ CXXFLAGS=-O2 -DNDEBUG
# gcc:--coverage
CXXFLAGS+= -Wall -I. -std=c++20
+CXXFLAGS+= -fPIE -DVERSION=\"$(VERSION)\"
+
ifeq ($(CXX),clang++-11)
CXXFLAGS+=-stdlib=libc++
@@ -114,6 +119,10 @@ test: unittest systemtest
check: test
+install:
+ mkdir -p $(DESTDIR)/usr/bin
+ cp mcc $(DESTDIR)/usr/bin
+
# Tests on C++ level
unittest: test-$(PROJECTNAME)
./test-$(PROJECTNAME) #--gtest_filter='CppTest.compile_parentheses_right'
@@ -145,6 +154,43 @@ googletest/src/%.o: googletest/src/%.cc
ADD_DEP=Makefile
# misc ---------------------------------------------------
+deb:
+ # build binary deb package
+ dpkg-buildpackage -rfakeroot
+
+deb-src:
+ dh_clean
+ dh_auto_clean
+ dpkg-source -b -I.git -Iresult .
+
+$(DISTROS): deb-src
+ sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../$(PROJECTNAME)_$(VERSION).dsc
+ debsign result/$@/$(PROJECTNAME)_$(VERSION)_amd64.changes
+
+debs: $(DISTROS)
+
+DISTFILES= \
+ $(TESTSRC) \
+ $(PROGSRC:.cpp=.h) \
+ debian/control \
+ debian/compat \
+ debian/copyright \
+ debian/source \
+ debian/source/format \
+ debian/changelog \
+ debian/README.Debian \
+ debian/rules \
+ README \
+ TODO
+
+dist: clean
+ rm -rf $(PROJECTNAME)-$(VERSION)
+ mkdir $(PROJECTNAME)-$(VERSION)
+ cp --parents -r $(DISTFILES) $(PROJECTNAME)-$(VERSION)
+ tar cfJ ../$(PROJECTNAME)-$(VERSION).tar.xz $(PROJECTNAME)-$(VERSION)
+ rm -rf $(PROJECTNAME)-$(VERSION)
+ ls -l ../$(PROJECTNAME)-$(VERSION).tar.xz
+
clean:
-rm -f test-$(PROJECTNAME) mcc tempfile.txt
-find . -name '*.o' -o -name '*.d' -o -name '*.gcno' -o -name '*.gcda' | xargs rm -f