CC      = clang
CFLAGS  += -Wall -Wextra -pedantic -std=gnu99 -lm
LDFLAGS += -std=gnu99 -lm

targets = hello cat string strings strings_lib errno float float_2 float_3 argv stack_overflow segmentation sizeof bad_file bad_scan bad_pointers malloc_test ArrayList_test mystery2 memory_leak badcnt goodcnt primes slowprimes bomb

all: $(targets)

ArrayList_test: ArrayList.o ArrayList_test.o
	$(CC) $(LDFLAGS) -o $@ $^

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

.PHONY: clean
clean:
	rm -rf *.o $(targets)

%: %.o
	$(CC) $(CFLAGS) -o $@ $^
