From b29a707988e88e57219720cd9c75581aab5fcc65 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 24 Sep 2024 23:15:10 -0500 Subject: [PATCH] More Makefile compression --- c/Makefile | 7 +++---- cplusplus/Makefile | 7 ++----- csharp/Makefile | 4 ++-- docs/Makefile | 14 +++----------- fortran/Makefile | 5 ++--- java/Makefile | 10 ++++------ javascript/Makefile | 7 +++---- python/Makefile | 25 ++++++++----------------- 8 files changed, 27 insertions(+), 52 deletions(-) diff --git a/c/Makefile b/c/Makefile index 967df0d4..075eb1ee 100644 --- a/c/Makefile +++ b/c/Makefile @@ -4,6 +4,7 @@ PIP?=$(PY) -m pip BLUE=\033[0;34m NC=\033[0m # No Color O?=2 +COV?=false ifneq ($(https_proxy), ) PROXY_ARG=--proxy=$(https_proxy) @@ -15,11 +16,9 @@ PROXY_ARG= endif endif -COV?=false -ifneq ($(COV),false) -pytest_args= -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose --cov -else pytest_args= -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose +ifneq ($(COV),false) +pytest_args+= --cov endif .PHONY: help diff --git a/cplusplus/Makefile b/cplusplus/Makefile index 97976920..8b84b0b7 100644 --- a/cplusplus/Makefile +++ b/cplusplus/Makefile @@ -4,15 +4,12 @@ PIP?=$(PY) -m pip BLUE=\033[0;34m NC=\033[0m # No Color O?=2 +PROXY_ARG= ifneq ($(https_proxy), ) PROXY_ARG=--proxy=$(https_proxy) -else -ifneq ($(http_proxy), ) +else ifneq ($(http_proxy), ) PROXY_ARG=--proxy=$(http_proxy) -else -PROXY_ARG= -endif endif .PHONY: help diff --git a/csharp/Makefile b/csharp/Makefile index b3f7dd49..182b3f6f 100644 --- a/csharp/Makefile +++ b/csharp/Makefile @@ -2,10 +2,10 @@ NOT_TERMUX?=$(shell command -v termux-setup-storage > /dev/null 2>&1 ; echo $$?) BLUE=\033[0;34m NC=\033[0m # No Color COV?=false +cov_args= + ifeq ($(COV),true) cov_args= --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.IncludeTestAssembly=true -else -cov_args= endif .PHONY: help diff --git a/docs/Makefile b/docs/Makefile index 5e34562c..2c0c7984 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,8 +1,3 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. SPHINXOPTS ?= -j auto SPHINXBUILD ?= sphinx-build SOURCEDIR = . @@ -10,17 +5,14 @@ BUILDDIR = _build PY?=python3 USER_FLAG?=--user PIP?=$(PY) -m pip +PROXY_ARG= + ifneq ($(https_proxy), ) PROXY_ARG=--proxy=$(https_proxy) -else -ifneq ($(http_proxy), ) +else ifneq ($(http_proxy), ) PROXY_ARG=--proxy=$(http_proxy) -else -PROXY_ARG= -endif endif -# Put it first so that "make" without argument is like "make help". .PHONY: help help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/fortran/Makefile b/fortran/Makefile index 573a7a7c..5c37c3ff 100644 --- a/fortran/Makefile +++ b/fortran/Makefile @@ -26,11 +26,10 @@ else opt_args = -Wall -Werror -march=native -flto -J$(BUILD_DIR) endif +cov_args= ifneq ($(COV),false) cov_args= -fprofile-arcs -ftest-coverage -O0 -else ifeq ($(FC),lfortran) - cov_args= -else +else ifneq ($(FC),lfortran) cov_args= -O2 endif diff --git a/java/Makefile b/java/Makefile index 396b2d21..13b6c0b6 100644 --- a/java/Makefile +++ b/java/Makefile @@ -14,18 +14,16 @@ help: clean: @$(MVN) clean || echo -target/jacoco.exec: ../LICENSE - @$(MVN) $(MVN_FLAGS) test -Dtest.single - .PHONY: test -test: target/jacoco.exec +test: @$(MVN) $(MVN_FLAGS) test -Dtest.single -test_auto: target/jacoco.exec +.PHONY: test_auto +test_auto: @$(MVN) $(MVN_FLAGS) test -T 1C .PHONY: test_% -test_%: target/jacoco.exec +test_%: @$(MVN) $(MVN_FLAGS) test -T $* .PHONY: lint diff --git a/javascript/Makefile b/javascript/Makefile index d3981e1a..36cd4a85 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -2,14 +2,13 @@ NOT_TERMUX?=$(shell command -v termux-setup-storage > /dev/null 2>&1 ; echo $$?) HAS_NPM?=$(shell command -v npm > /dev/null 2>&1 ; echo $$?) HAS_BUN?=$(shell command -v bun > /dev/null 2>&1 ; echo $$?) COV?=false +BLUE=\033[0;34m +NC=\033[0m # No Color +MOCHA=npx mocha ifeq ($(COV),true) MOCHA=istanbul cover ./node_modules/mocha/bin/_mocha -else -MOCHA=npx mocha endif -BLUE=\033[0;34m -NC=\033[0m # No Color .PHONY: help help: diff --git a/python/Makefile b/python/Makefile index 84320f4e..af11ac63 100644 --- a/python/Makefile +++ b/python/Makefile @@ -4,42 +4,34 @@ USER_FLAG?=--user PIP?=$(PY) -m pip MYPY?=true COV?=false +BLUE=\033[0;34m +NC=\033[0m # No Color +benchmark_flags=--benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose ifneq ($(MYPY),true) LINT=less endif -benchmark_flags=--benchmark-min-time=0.05 --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose - ifeq ($(LINT),false) pytest_args?= -vl -else -ifeq ($(LINT),true) +else ifeq ($(LINT),true) pytest_args?= -vl --mypy --mypy-ignore-missing-imports --isort --flake8 -k 'not test_problem and not test_is_prime and not test_groupwise' -else -ifeq ($(LINT),less) +else ifeq ($(LINT),less) pytest_args?= -vl --isort else pytest_args?= -vl --mypy --mypy-ignore-missing-imports --isort --flake8 endif -endif -endif ifeq ($(COV),true) pytest_args+= --cov endif +PROXY_ARG= ifneq ($(https_proxy), ) PROXY_ARG=--proxy=$(https_proxy) -else -ifneq ($(http_proxy), ) +else ifneq ($(http_proxy), ) PROXY_ARG=--proxy=$(http_proxy) -else -PROXY_ARG= endif -endif -BLUE=\033[0;34m -NC=\033[0m # No Color .PHONY: help help: @@ -57,11 +49,10 @@ test_%: ../LICENSE dependencies @$(PY) -m pytest $(pytest_args) -d -n$* .PHONY: dependencies -ifeq ($(MYPY),true) dependencies: +ifeq ($(MYPY),true) @$(PIP) install -r requirements.txt $(USER_FLAG) $(PROXY_ARG) else -dependencies: @cat requirements.txt | grep -v "mypy" > .requirements.txt @$(PIP) install -r .requirements.txt $(USER_FLAG) $(PROXY_ARG) endif