# lower-level makefile (in src folder), a simple makefile to compile all modules # Huan Chen, 1/31/2017 CC = gcc CFLAGS = -ansi -Wall -g # list all *.c files in current directory (rule.c, userIO.c, board.c, etc.) C_FILES := $(wildcard *.c) # generate the names of all object files (rule.o, userIO.o, board.o, etc.) OBJS := $(patsubst %.c, %.o, $(C_FILES)) DEPS = Type.h Piece.h # etc. BDIR = ../bin TARGET = chess all: $(TARGET) $(TARGET): $(OBJS) $(CC) $(CFLAGS) $^ -o $@ @cp $@ $(BDIR)/$@ # dummy compilation %.o: %.c $(DEPS) $(CC) $(CFLAGS) -c $< -o $@ test: @echo "Testing rule.c..." @echo "Testing AI vs AI..." .PHONY: clean clean: rm -f *.o .#* *~ $(TARGET); rm -rf $(BDIR)/* @# .#*: temporary cvs files; *~: temporary emacs files