From 7fd9bbf4ea1ba5ea1b30e9ba3039195ab40c246a Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 21 Nov 2020 16:49:31 +0100 Subject: Added debian packaging --- Makefile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'Makefile') 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 -- cgit v1.2.3