Makefile

69 lines · 2620 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 gen_changelog validate review review_diff 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 -q -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
45gen_changelog: install_lib_deps
46	$(PYTHON) $(LIB_DIR)/generate-changelog.py
47
48review: install_lib_deps
49	$(PYTHON) $(LIB_DIR)/review-listings.py $(ARGS)
50
51review_diff: install_lib_deps
52	$(PYTHON) $(LIB_DIR)/review-listings.py --changed-since $(or $(BASE),main) $(ARGS)
53
54lib: install_lib_deps validate gen_readme gen_changelog
55
56# Targets for web/
57install_web_deps:
58	cd $(WEB_DIR) && yarn install
59
60build_web: install_web_deps
61	cd $(WEB_DIR) && yarn build
62
63start_web: build_web
64	cd $(WEB_DIR) && yarn start
65
66dev_web: install_web_deps
67	cd $(WEB_DIR) && yarn dev
68
69web: install_web_deps build_web start_web