Skip to content

Commit

Permalink
More Makefile revamps
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 11, 2024
1 parent f514856 commit efe12ca
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 7 additions & 8 deletions c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,15 +49,15 @@ 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
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
7 changes: 3 additions & 4 deletions cplusplus/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ 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

_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
Expand Down
10 changes: 5 additions & 5 deletions javascript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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_%
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit efe12ca

Please sign in to comment.