# $VER: Makefile 1.0 (18-Sep-95)
#--------------------------------------------------------------------------
# Makefile for MkDepend
#
# Written for use with DICE 3 and Dennis Vadura's DMake 3.8p4.
# It assumes a proper startup.mk .
#--------------------------------------------------------------------------
# Available targets:
#  MkDepend: creates the program.
#  clean   : deletes all objects, test.#? and a.out.
#  clobber : same as clean, also deletes the executable.
#  depend  : updates the Makefile by the source dependencies.
#  archive : creates an archive MkDepend-<version>.lha

# Release version, should match the version number in main.c and DMakefile.
VERSION= 1.0

#--------------------------------------------------------------------------
# Source files
SOURCES= main.c reader.c nodes.c

# Other files to archive
OTHER= Makefile DMakefile MkDepend.doc MkDepend.readme

# Object files to generate
OBJECTS= obj/{$(SOURCES:b)}.o

# Check prototypes on compilation
CFLAGS+= -proto

# Default rule to compile objects into a subdirectory obj/
%$O : $$(@:b).c ; $(CC) $(CFLAGS) -c $< -o $@

#--------------------------------------------------------------------------

MkDepend : obj

MkDepend : $(OBJECTS)
	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)

clean :
	-delete #?.o test.#? a.out
	-delete obj/#?.o

clobber : clean
	-delete MkDepend MkDepend-#?.readme MkDepend-#?.lha
	-delete obj all

depend : $(SOURCES)
	MkDepend $(SOURCES) -p.c:obj/%n.o -fMakefile


archive : depend MkDepend
	makedir MkDepend-$(VERSION)
	copy MkDepend $(SOURCES) $(OTHER) MkDepend-$(VERSION) clone
	copy MkDepend.readme MkDepend-$(VERSION).readme
	-delete MkDepend-$(VERSION).lha
	lha -axmr a MkDepend-$(VERSION).lha MkDepend-$(VERSION)
	delete MkDepend-$(VERSION) all quiet
	@+echo "Archive created."

obj :
	makedir obj

# --- DO NOT MODIFY THIS LINE -- AUTO-DEPENDS FOLLOW ---
obj/main.o :  main.c nodes.h reader.h

obj/nodes.o :  nodes.c nodes.h

obj/reader.o :  reader.c reader.h

