# =============================================================================
# Makefile for CMU 15-213 Lecture 19 (file systems & network programming I)
# =============================================================================
#
#   make run      run both demos
#   make clean
#
# 01 is a deterministic Python teaching file system (identical on 3.9 and 3.13).
# 02 is real C: byte order, inet_pton/ntop and getaddrinfo. `make run` resolves
# only "localhost", so it needs no network; pass a hostname to see real DNS:
#       ./build/02_addresses www.cmu.edu
# -----------------------------------------------------------------------------

CC     ?= cc
CFLAGS := -std=c11 -O2 -Wall -Wextra

.PHONY: all run clean
all: build/02_addresses

build:
	mkdir -p build

build/02_addresses: 02_addresses.c | build
	$(CC) $(CFLAGS) -o $@ 02_addresses.c

run: all
	@python3 01_filesystem.py
	@echo; ./build/02_addresses

clean:
	rm -rf build __pycache__
