# Standalone (no-Docker) Makefile for Lab 3 -- BACKUP setup.
#
# Use this only if you cannot get Docker / docker-compose working. It builds
# the SAME vulnerable program the containers run, so you can drive it directly
# from the shell instead of over the network:
#
#     make                          # builds format-32 (and format-64)
#     cat badfile | ./format-32     # Tasks 1-3
#     cat badfile | sudo ./format-32   # Task 4 (root shell, see the handout)
#
# The instructor may give you a specific value of L (the stack-layout knob);
# set it below before building. Different L values shift every offset in your
# payloads, so use the value you are told.

STD      = -std=gnu17
FLAGS    = -z execstack
FLAGS_32 = -static -m32
TARGET   = format-32 format-64

L = 100

all: $(TARGET)

format-32: format.c
	gcc $(STD) -DBUF_SIZE=$(L) $(FLAGS) $(FLAGS_32) -o $@ format.c

format-64: format.c
	gcc $(STD) -DBUF_SIZE=$(L) $(FLAGS) -o $@ format.c

clean:
	rm -f badfile $(TARGET)
