summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile88
1 files changed, 88 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..aafa42a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,88 @@
+#
+# Makefile
+#
+# Environment: Debian
+#
+
+include common.mk
+
+PROJECTNAME=whiteboard
+
+DISTROS=base debian11 ubuntu2210
+TGZNAME=$(PROJECTNAME)-$(VERSION).tar.xz
+
+INCLUDES=-I.
+HEADERS=config.h qrcode.h storage.h whiteboard.h compiledsql.h connectionregistry.h diff.h
+SOURCES=$(HEADERS:.h=.cpp)
+OBJECTS=$(HEADERS:.h=.o)
+TARGETS=whiteboard
+
+build: $(TARGETS)
+ $(MAKE) -C webassembly
+
+all: build
+ ./whiteboard -c whiteboard.conf
+
+install:
+ mkdir -p $(DESTDIR)/usr/bin
+ cp whiteboard $(DESTDIR)/usr/bin
+
+ mkdir -p $(DESTDIR)/usr/lib/whiteboard/html
+ cp -r html/* $(DESTDIR)/usr/lib/whiteboard/html/
+
+ uglifyjs html/whiteboard.js -m -c > $(DESTDIR)/usr/lib/whiteboard/html/whiteboard.js || cp html/whiteboard.js $(DESTDIR)/usr/lib/whiteboard/html/whiteboard.js
+ htmlmin html/index.html $(DESTDIR)/usr/lib/whiteboard/html/index.html
+ cleancss -o $(DESTDIR)/usr/lib/whiteboard/html/whiteboard.css html/whiteboard.css
+
+ mkdir -p $(DESTDIR)/etc
+ cp whiteboard.conf $(DESTDIR)/etc
+
+# link
+whiteboard: $(OBJECTS) main.o
+ $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
+
+# .cpp -> .o
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
+
+test:
+ $(MAKE) -C tests
+
+clean:
+ -rm -f *.o $(TARGETS) *.gcov
+ -rm -f html/libwhiteboard.wasm html/libwhiteboard.js
+ $(MAKE) -C tests clean
+ $(MAKE) -C webassembly clean
+
+deb:
+ dpkg-buildpackage
+
+deb-src: clean
+ 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
+
+DISTFILES=$(shell git ls-files 2>/dev/null)
+
+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
+
+upload: dist
+ scp ../$(TGZNAME) antcom.de:/var/www/reichwein.it-download/
+ scp -r result antcom.de:
+ scp -r remote-install.sh antcom.de:
+ ssh antcom.de ./remote-install.sh $(PROJECTNAME) $(VERSION)
+ ssh antcom.de rm -rf remote-install.sh result
+
+debs: $(DISTROS)
+
+.PHONY: clean