From efe12ca9fb28667d14e00a2105da2e7bcc518bd1 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 11 Aug 2024 03:07:57 -0500 Subject: [PATCH] More Makefile revamps --- Makefile | 21 +++++++++++---------- c/Makefile | 15 +++++++-------- cplusplus/Makefile | 7 +++---- docs/Makefile | 5 +++-- javascript/Makefile | 10 +++++----- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 042c550d..2d415088 100644 --- a/Makefile +++ b/Makefile @@ -39,42 +39,43 @@ help: LICENSE .PHONY: html dirhtml singlehtml epub latex html dirhtml singlehtml epub latex: LICENSE - @$(MAKE) docs_$@ $(MFLAGS) + @$(MAKE) docs_$@ $(MFLAGS) --no-print-directory .PHONY: clean -clean: cs_clean cp_clean c_clean ja_clean js_clean py_clean rs_clean docs_clean +clean: + @$(MAKE) cs_clean cp_clean c_clean ja_clean js_clean py_clean rs_clean docs_clean $(MFLAGS) -j --no-print-directory .PHONY: cs_% cs_%: LICENSE - @cd csharp && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C csharp $* $(MFLAGS) --no-print-directory .PHONY: cp_% cp_%: LICENSE - @cd cplusplus && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C cplusplus $* $(MFLAGS) --no-print-directory .PHONY: c_% c_%: LICENSE - @cd c && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C c $* $(MFLAGS) --no-print-directory .PHONY: docs_% docs_%: LICENSE - @cd docs && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C docs $* $(MFLAGS) --no-print-directory .PHONY: ja_% ja_%: LICENSE - @cd java && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C java $* $(MFLAGS) --no-print-directory .PHONY: js_% js_%: LICENSE - @cd javascript && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C javascript $* $(MFLAGS) --no-print-directory .PHONY: py_% py_%: LICENSE - @cd python && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C python $* $(MFLAGS) --no-print-directory .PHONY: rs_% rs_%: LICENSE - @cd rust && $(MAKE) $* $(MFLAGS) --no-print-directory + @$(MAKE) -C rust $* $(MFLAGS) --no-print-directory %: @$(MAKE) c_$* cp_$* cs_$* ja_$* js_$* py_$* rs_$* $(MFLAGS) --no-print-directory diff --git a/c/Makefile b/c/Makefile index f7d99994..408dbf15 100644 --- a/c/Makefile +++ b/c/Makefile @@ -24,21 +24,20 @@ help: @echo " $(BLUE)clean$(NC) clean up any stray files" .PHONY: test_% -test_%: ../LICENSE submodules dependencies - @cd ../python; $(MAKE) dependencies $(MFLAGS) +test_%: ../LICENSE dependencies @$(PY) -m pytest -dvl -n$* test_euler.py --cov .PHONY: test -test: ../LICENSE submodules dependencies +test: ../LICENSE dependencies @$(PY) -m pytest -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose test_euler.py --cov -.PHONY: submodules -submodules: +Unity/src/unity.c: @git submodule init @git submodule update .PHONY: dependencies -dependencies: submodules +dependencies: Unity/src/unity.c + @$(MAKE) -C ../python dependencies $(MFLAGS) @$(PIP) install -r requirements.txt -r ../python/requirements.txt $(USER_FLAG) $(PROXY_ARG) .PHONY: lint @@ -50,7 +49,7 @@ lint: fi .PHONY: native -native: ../LICENSE submodules +native: ../LICENSE Unity/src/unity.c @$(CC) test.c Unity/src/unity.c -O2 -lm -lc -Wall -Werror -march=native -flto -DAMD_COMPILER=0 .PHONY: clean @@ -58,7 +57,7 @@ clean: @rm -rf build {.,*,*/*}/{*.pyc,__pycache__,.mypy_cache,.pytest_cache,.benchmarks} || echo .PHONY: wasm -wasm: ../LICENSE submodules +wasm: ../LICENSE @wget https://github.com/jedisct1/libclang_rt.builtins-wasm32.a -O wasm32.a @mkdir -p build @clang -DUNITY_END --target=wasm32-unknown-wasi --sysroot /tmp/wasi-libc -nostartfiles -Wl,--import-memory -Wl,--no-entry -Wl,--export-all -o build/c.wasm test.c diff --git a/cplusplus/Makefile b/cplusplus/Makefile index 5fd56f98..8880fb9b 100644 --- a/cplusplus/Makefile +++ b/cplusplus/Makefile @@ -24,20 +24,19 @@ help: .PHONY: test_% test_%: ../LICENSE dependencies - @cd ../python; $(MAKE) dependencies $(MFLAGS) @$(PY) -m pytest -dvl -n$* test_euler.py --cov .PHONY: test test: ../LICENSE dependencies @$(PY) -m pytest -vl --benchmark-sort=fullname --benchmark-group-by=fullfunc --benchmark-verbose test_euler.py --cov -.PHONY: submodules -submodules: +Unity: @git submodule init @git submodule update .PHONY: dependencies -dependencies: +dependencies: Unity + @$(MAKE) -C ../python dependencies $(MFLAGS) @$(PIP) install -r requirements.txt -r ../python/requirements.txt $(USER_FLAG) $(PROXY_ARG) .PHONY: lint diff --git a/docs/Makefile b/docs/Makefile index 373da406..4d4551db 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -35,7 +35,7 @@ dependencies: @npm install -g jsdoc _static/dist/bundle.js: - @cd ../javascript && $(MAKE) webpack $(MFLAGS) + @$(MAKE) -C javascript webpack $(MFLAGS) @mkdir -p _static/dist @cp ../javascript/dist/bundle-js.js _static/dist/bundle-js.js @@ -43,7 +43,8 @@ _static/dist/python.tar.gz: @cd ../python && $(MAKE) webpack $(MFLAGS) .PHONY: html -html: _static/dist/bundle.js _static/dist/python.tar.gz +html: + @$(MAKE) _static/dist/bundle.js _static/dist/python.tar.gz $(MFLAGS) -j @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) # Catch-all target: route all unknown targets to Sphinx using the new diff --git a/javascript/Makefile b/javascript/Makefile index 98467be5..fa4d9478 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -25,7 +25,7 @@ help: test: ../LICENSE dependencies bun_test @$(MOCHA) euler.test.js -test_auto: dependencies bun_test +test_auto:../LICENSE dependencies bun_test @$(MOCHA) --parallel euler.test.js .PHONY: test_% @@ -61,21 +61,21 @@ else ifeq ($(NOT_TERMUX),0) # if no NPM and Termux dependencies: @pkg install -y nodejs; - @$(MAKE) node_modules $(MFLAGS) + @$(MAKE) node_modules/chai/LICENSE $(MFLAGS) --no-print-directory else # if no NPM and not Termux dependencies: @curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash \ @export NVM_DIR="$$HOME/.nvm"; \ @[ -s "$$NVM_DIR/nvm.sh" ] && \. "$$NVM_DIR/nvm.sh" \ @nvm install --lts - @$(MAKE) node_modules $(MFLAGS) + @$(MAKE) node_modules/chai/LICENSE $(MFLAGS) --no-print-directory endif endif else # has NPM -dependencies: node_modules +dependencies: node_modules/chai/LICENSE endif -node_modules: +node_modules/chai/LICENSE: ifeq ($(COV),true) @npm install -g istanbul endif