# =============================================================================
# Makefile for CMU 15-213 Lecture 7 (linking)
# =============================================================================
#
# Unlike the other lectures, the "programs" here are produced BY the demos:
# each Python demo drives the real toolchain (cc, nm, objdump, ar, dlopen)
# and reads its output. So `make run` just runs the four demos, and `make
# clean` removes the scratch build/ directory they create.
#
#   make run      run the four demos
#   make clean    remove build/
#
# Requirements: a C compiler, nm, objdump (llvm or GNU), ar, and Python 3.9+.
# On an Apple-Silicon Mac the relocation demo cross-compiles to x86-64 (as the
# other lectures do); everything else uses the native toolchain.
# -----------------------------------------------------------------------------

.PHONY: run clean
run:
	@python3 01_symbols.py
	@echo; python3 02_relocation.py
	@echo; python3 03_static_libraries.py
	@echo; python3 04_shared_libraries.py

clean:
	rm -rf build __pycache__
