Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/core/build/Makefile-rules
1067 views

.PHONY: native
native: ${DIST_NATIVE}/.built

.PHONY: wasm
wasm: ${DIST_WASM}/.built

.PHONY: deps
deps: node_modules
	@[[ -f ${DIST_WASM}/.built ]] || node ../build/make-dependencies.js

.PHONY: clean-wasm
clean-wasm::
	rm -rf ${BUILD_WASM} ${DIST_WASM}

.PHONY: clean-native
clean-native::
	rm -rf ${BUILD_NATIVE} ${DIST_NATIVE}

.PHONY: clean-build
clean-build::
	rm -rf ${BUILD} ${SRC}/zig-cache

clean-node_modules::
	rm -rf node_modules

.PHONY: clean
clean:: clean-wasm clean-native clean-node_modules
	rm -rf ${BUILD} ${DIST} tsconfig.tsbuildinfo ${SRC}/zig-cache

${TARBALL}:
	mkdir -p ${UPSTREAM}
	curl -L ${URL} -o ${TARBALL}

# NOTE: these double colon rules can be nicely overridden, which is where additional patching goes.
#       See https://stackoverflow.com/questions/1644920/override-target-in-makefile-to-add-more-commands
#
${BUILD_NATIVE}/.build:: ${TARBALL}
	rm -rf ${BUILD_NATIVE}
	mkdir -p ${BUILD_NATIVE}
	tar xf ${TARBALL} -C ${BUILD_NATIVE} --strip-components=1
	touch ${BUILD_NATIVE}/.build

${BUILD_WASM}/.build:: ${TARBALL}
	rm -rf ${BUILD_WASM}
	mkdir -p ${BUILD_WASM}
	tar xf ${TARBALL} -C ${BUILD_WASM} --strip-components=1
	touch ${BUILD_WASM}/.build

node_modules:
	pnpm install
	# make the node_modules folder, in case nothing actually installed
	mkdir -p node_modules