Skip to content

Commit 064e505

Browse files
Updating Makefile for Windows
1 parent 5628e83 commit 064e505

3 files changed

Lines changed: 33 additions & 329 deletions

File tree

Makefile

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
-include .env
22

33
ROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
4-
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
54
PROJECT := InsecureWebApp
6-
PROJECT_LOWER := $(shell echo $(PROJECT) | tr '[:upper:]' '[:lower:]')
7-
PROJECTS := $(shell ls . | grep project)
5+
PROJECT_LOWER := $(call tolower,$(PROJECT))
6+
PROJECTS := $(filter %project%,$(wildcard *))
87
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2> /dev/null || echo "1.0.0")
98
COMMIT := $(shell git log -1 --pretty=format:"%H")
10-
UNAME := $(shell uname)
119

1210
FLASK_APP := iwa
1311

@@ -29,12 +27,7 @@ default: help
2927
# generate help info from comments
3028
.PHONY: help
3129
help: ## help information about make commands
32-
ifeq ($(OS),Windows_NT)
33-
@echo Running on Windows: $(OS)
34-
else
35-
@echo Running on Linux/UNIX: $(UNAME)
36-
endif
37-
@grep -h -P '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
30+
@python etc/print_makefile_help.py
3831

3932
.PHONY: version
4033
version: ## display the version of the service
@@ -44,6 +37,7 @@ version: ## display the version of the service
4437
build: ## build the project
4538
@echo "Building $(PROJECT)..."
4639
python -m venv .venv
40+
pip install -U flask
4741
ifeq ($(OS),Windows_NT)
4842
cmd /c .\.venv\Scripts\activate.bat
4943
.venv/Scripts/pip install -r requirements.txt
@@ -61,7 +55,7 @@ build-docker: ## build the project as a docker image
6155
run: ## run the project
6256
@echo "Running $(PROJECT)..."
6357
ifeq ($(OS),Windows_NT)
64-
cmd /C "set FLASK_ENV=development && set FLASK_DEBUG=1 && set FLASK_APP=$(FLASK_APP) && flask run --host 0.0.0.0"
58+
cmd /C ".\.venv\Scripts\activate.bat && set FLASK_ENV=development && set FLASK_DEBUG=1 && set FLASK_APP=$(FLASK_APP) && flask run --host 0.0.0.0"
6559
else
6660
FLASK_ENV=development FLASK_DEBUG=1 FLASK_APP=$(FLASK_APP) .venv/bin/flask run --host 0.0.0.0
6761
endif
@@ -70,26 +64,27 @@ endif
7064
run-production: ## run the project in production mode
7165
@echo "Running $(PROJECT) in production mode..."
7266
ifeq ($(OS),Windows_NT)
73-
cmd /C "set FLASK_ENV=production && set FLASK_APP=$(FLASK_APP) && flask run --host 0.0.0.0"
67+
cmd /C ".\.venv\Scripts\activate.bat && set FLASK_ENV=production && set FLASK_APP=$(FLASK_APP) && flask run --host 0.0.0.0"
7468
else
7569
FLASK_ENV=production FLASK_APP=$(FLASK_APP) .venv/bin/flask run --host 0.0.0.0
7670
endif
7771

7872
.PHONY: test
7973
test: ## run unit tests for the project
8074
@echo "Testing $(PROJECT)..."
75+
pip install -U pytest
8176
ifeq ($(OS),Windows_NT)
82-
cmd /C "set FLASK_ENV=development && set FLASK_DEBUG=1 && set FLASK_APP=$(FLASK_APP) && pytest"
77+
cmd /C ".\.venv\Scripts\activate.bat && set FLASK_ENV=development && set FLASK_DEBUG=1 && set FLASK_APP=$(FLASK_APP) && pytest"
8378
else
8479
FLASK_ENV=development FLASK_DEBUG=1 FLASK_APP=$(FLASK_APP) .venv/bin/pytest
8580
endif
8681

8782
.PHONY: clean
8883
clean: ## remove temporary files
8984
ifeq ($(OS),Windows_NT)
90-
cmd /c "rmdir /s /q instance .venv .fortify"
85+
cmd /c "rmdir /s /q instance .venv .fortify bandit-report.html"
9186
else
92-
rm -rf instance .venv .fortify
87+
rm -rf instance .venv .fortify bandit-report.html
9388
endif
9489

9590
.PHONY: bandit-scan

bandit-report.html

Lines changed: 0 additions & 314 deletions
This file was deleted.

0 commit comments

Comments
 (0)