summaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 657afe51fb8d5e12ae9f278fcd074b5656c30cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#
# Makefile
#
# Environment: Debian
#

#CC=gcc-9
#CXX=g++-9
CC=clang-10
CXX=clang++-10

LIBS=-lfcgi
INCLUDES=-I.
CFLAGS=-Wall -g -O2 -fPIC
CPPFLAGS=-Wall -g -O2 -fPIC -std=c++17 -Wpedantic
HEADERS=file.h
SOURCES=$(HEADERS:.h=.cpp)
OBJECTS=$(HEADERS:.h=.o)
TARGETS=downtube.fcgi

build: $(TARGETS)

all: build
	./start.sh

install:
	mkdir -p $(DESTDIR)/usr/lib/downtube
	cp downtube.fcgi $(DESTDIR)/usr/lib/downtube/

	mkdir -p $(DESTDIR)/usr/lib/downtube/html
        cp -r html/* $(DESTDIR)/usr/lib/downtube/html/

        uglifyjs html/downtube.js -m -c > $(DESTDIR)/usr/lib/downtube/html/downtube.js
        htmlmin html/index.html $(DESTDIR)/usr/lib/downtube/html/index.html
        cleancss -o $(DESTDIR)/usr/lib/downtube/html/downtube.css html/downtube.css


downtube.fcgi: $(OBJECTS)

# link
%.fcgi: %.o
	$(CXX) $(CPPFLAGS) $(LIBS) -o $@ $^

# .cpp -> .o
%.o: %.cpp
	$(CXX) $(CPPFLAGS) $(INCLUDES) -c $< -o $@

clean:
	rm -f *.o *.fcgi

deb:
	dpkg-buildpackage

.PHONY: clean