Makefile

60 lines · 2303 bytes

 1
 2#########################################################################
 3# Welcome to Awesome Privacy!                                           #
 4# This file contains all the commands for the project (in lib and web)  #
 5#                                                                       #
 6# lib commands:                                                         #
 7# make install_lib_deps - Install Python dependencies for lib/          #
 8# make validate - Validates awesome-privacy.yml against the schema      #
 9# make gen_readme - Generate README.md from awesome-privacy.yml         #
10#                                                                       #
11# web commands:                                                         #
12# make install_web_deps - Install NPM dependencies for the website      #
13# make build_web - Build the static website (outputs to web/dist/)      #
14# make start_web - Starts a webserver to serve the static website       #
15#                                                                       #
16# For further documentation, please reference the GitHub repository.    #
17# https://github.com/lissy93/awesome-privacy or awesome-privacy.xyz     #
18#                                                                       #
19#########################################################################
20# Licensed under CC0-1.0 (C) Alicia Sykes <https://aliciasykes.com>     #
21#########################################################################
22
23# Targets
24.PHONY: all \
25    install_lib_deps gen_readme validate lib \
26    install_web_deps build_web start_web web
27
28# Get Python bin
29PYTHON := $(shell which python3 2>/dev/null || which python)
30
31# Directory Locations
32LIB_DIR := lib
33WEB_DIR := web
34
35# Targets for lib/
36install_lib_deps:
37	$(PYTHON) -m pip install -r $(LIB_DIR)/requirements.txt
38
39gen_readme: install_lib_deps
40	$(PYTHON) $(LIB_DIR)/awesome-privacy-readme-gen.py
41
42validate: install_lib_deps
43	$(PYTHON) $(LIB_DIR)/validate-awesome-privacy.py
44
45lib: install_lib_deps validate gen_readme
46
47# Targets for web/
48install_web_deps:
49	cd $(WEB_DIR) && yarn install
50
51build_web: install_web_deps
52	cd $(WEB_DIR) && yarn build
53
54start_web: build_web
55	cd $(WEB_DIR) && yarn start
56
57dev_web: install_web_deps
58	cd $(WEB_DIR) && yarn dev
59
60web: install_web_deps build_web start_web