# Tower of Hanoi makefile
# Make file to build a library with all but solution.o included.
#
# The following directory structure is assumed:
#
#   class (or any name you wish)
#     |
#     +- include
#     |     |
#     |     +- hanoi.h
#     |
#     +- lib
#     |   |
#     |   +- hanoi_lib
#     |
#     +- teacher
#     |     |
#     |     +- game.c
#     |     +- hanoi.c
#     |     +- puzzle.c
#     |     +- solution.c
#     |     +- makelib (this file)
#     |     +- student_make
#     |
#     +- student1
#     |      |
#     |      +- hanoi.c (student1's version of solution.c)
#     |      +- makefile (a link to student_make in the teacher's directory).
#     |
#     +- student2
#     |      |
#     |      +- hanoi.c (student2's version of solution.c)
#     |      +- makefile (a link to student_make in the teacher's directory).
#     |
#     ...
#     |
#     +- studentN
#            |
#            +- hanoi.c (studentN's version of solution.c)
#            +- makefile (a link to student_make in the teacher's directory).
#
# Modifications to the assumed directory structure can be made by changing
# the INC_DIR and LIB_DIR macros below.
#
#-----------------------------------------------------------------------------

SRC=main.c game.c puzzle.c
OBJS=$(SRC:.c=.o)
INC_DIR=../include
HDR=$(INC_DIR)/hanoi.h
LIB_DIR=../lib
RELSTRING=2.2
TIMESTAMP=2006/08/17 03:13:52 GMT
CFLAGS += -DRELSTRING="\"$(RELSTRING)\"" -DRELDATE="\"$(TIMESTAMP)\"" -I$(INC_DIR)

all: $(LIB_DIR)/hanoi_lib.a

.PHONY: all hanoi_objs

$(LIB_DIR)/hanoi_lib.a: hanoi_lib.a
	mv hanoi_lib.a $(LIB_DIR)

hanoi_lib.a: hanoi_objs
	$(AR) $(ARFLAGS) $@ *.o
	rm *.o
	rm -f main.c

hanoi_objs: $(OBJS)

main.c: hanoi.c
	ln hanoi.c main.c

$(OBJS): $(HDR)


Last updated: Friday, June 12, 2015 03:21:43 AM