summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2022-11-05 13:49:53 +0100
committerRoland Reichwein <mail@reichwein.it>2022-11-05 13:49:53 +0100
commit4aeab7931182cb1c35bd5c52b58d71b30c32674d (patch)
treee9635c5b2c0827f16dc2021a6193139ef536793b /Makefile
Initial files, WIP
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile90
1 files changed, 90 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..034b024
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,90 @@
+#
+# Makefile
+#
+# Environment: Debian
+#
+
+DISTROS=debian10 debian11 ubuntu2004 ubuntu2204
+VERSION=$(shell dpkg-parsechangelog --show-field Version)
+
+CXX=clang++-10
+
+ifeq ($(shell which $(CXX)),)
+CXX=clang++
+endif
+
+ifeq ($(shell which $(CXX)),)
+CXX=g++-9
+endif
+
+ifeq ($(shell which $(CXX)),)
+CXX=g++
+endif
+
+LIBS=-lfcgi -lboost_filesystem
+INCLUDES=-I.
+CXXFLAGS=-Wall -g -O2 -fPIC -std=c++17 -Wpedantic
+HEADERS=file.h
+SOURCES=$(HEADERS:.h=.cpp)
+OBJECTS=$(HEADERS:.h=.o)
+TARGETS=whiteboard.fcgi
+
+ifeq ($(CXX),clang++-10)
+LIBS+= \
+-fuse-ld=lld-10 \
+-lstdc++
+#-lc++ \
+#-lc++abi
+#-lc++fs
+#-lstdc++fs
+else
+LIBS+= \
+-lstdc++ \
+-lstdc++fs
+endif
+
+build: $(TARGETS)
+
+all: build
+ ./start.sh
+
+install:
+ mkdir -p $(DESTDIR)/usr/lib/whiteboard
+ cp whiteboard.fcgi $(DESTDIR)/usr/lib/whiteboard/
+
+ 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
+ htmlmin html/index.html $(DESTDIR)/usr/lib/whiteboard/html/index.html
+ cleancss -o $(DESTDIR)/usr/lib/whiteboard/html/whiteboard.css html/whiteboard.css
+
+
+whiteboard.fcgi: $(OBJECTS)
+
+# link
+%.fcgi: %.o
+ $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
+
+# .cpp -> .o
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
+
+clean:
+ -rm -f *.o *.fcgi
+
+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/$@ ../whiteboard_$(VERSION).dsc
+ debsign result/$@/whiteboard_$(VERSION)_amd64.changes
+
+debs: $(DISTROS)
+
+.PHONY: clean