summaryrefslogtreecommitdiff
path: root/Makefile
blob: dcc0d8bc53e84bbc65d696586e648aa4aab27a56 (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
.PHONY: local build compress upload clean
build:
	hugo
compress: 
	@dir_path="./public"; \
	ignored=0; \
	compressed=0; \
	for file in $$(find "$$dir_path" -type f ! -name "*.gz"); do \
		gzip -9nc "$$file" > "$${file}.test.gz"; \
		if cmp -s "$${file}.gz" "$${file}.test.gz"; then \
			rm "$${file}.test.gz"; \
			ignored=$$((ignored+1)); \
		else \
			mv "$${file}.test.gz" "$${file}.gz"; \
			compressed=$$((compressed+1)); \
			echo "Compressed: $$file.gz"; \
		fi; \
	done; \
	echo "Ignored $$ignored files. Total compressed: $$compressed."
upload: 
	source_dir="public/"; \
	dest_server="mms@michal.sapka.me:/var/www/htdocs/michal.sapka.me"; \
	rsync -irtvzP --delete  "$$source_dir" "$$dest_server"; \
	echo "Rsync completed."
interlace_images:
	@dir_path="./public"; \
	for file in $$(find "$$dir_path" -type f -name "*.jpg" -mtime -1); do \
                convert $$file -interlace plane $$file; \
	done;
clean:
	rm -r public
deploy: build  compress upload