# A simple makefile for building a program composed of C source files.
# Refer to CS107 guide to Make for background info on makefiles

PROGRAMS = mulq_ex remdiv test_while abstest mov_examples_main prac3_18

all:: $(PROGRAMS) $(PROGRAMS_OG) $(PROGRAMS_O3)

CC = gcc
CFLAGS = -g -Og -std=gnu99 -Wall $$warnflags

export warnflags = -Wfloat-equal -Wtype-limits -Wpointer-arith -Wlogical-op -Wshadow -fno-diagnostics-show-option
LDFLAGS =
LDLIBS =

$(PROGRAMS): %:%.c
	$(CC) -c $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS)
	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@

test_while: while_loop.c 

abstest: absdiff.s cmovdiff.s clockticks.s

mov_examples_main: mov_examples.s

clean::
	rm -f $(PROGRAMS) *.o

.PHONY: clean all
