#
# Makefile for the Linux JFS logview program
#
#

# We will use the GNU C Compiler
CC = gcc

# The source code and its dependencies can be found in the following path
VPATH = .:../libfs:../../../../include/linux/jfs

# xchkdmp is composed of the following object and source
OBJS = xchkdmp.o

SRCS = xchkdmp.c

# The following paths should be searched for header files
INCLUDE = -I../../../../include/linux/jfs -I../libfs

# Comment out the following line when doing a retail (non-debug) build
DEBUG = 1

# Compiler Flags to use
ifndef DEBUG
  CFLAGS = -O2 -c -static -Wall
else
  CFLAGS = -ggdb -Wall -c
endif

# Symbols that must be defined for proper compilation
SYMS = -D_LINUX -D_GNU_SOURCE -D_JFS_UTILITY -DONE_FILESET_PER_AGGR -D_FILE_OFFSET_BITS=64

# Default compilation rule
.c.o:
	$(CC) $(CFLAGS) $(SYMS) $(INCLUDE) $< -o $@

# Default rule for building xchkdmp
all: xchkdmp


# Rule for generating dependency information
dep:
	-rm -f .depend
	$(CC) -MM $(SYMS) $(INCLUDE) $(SRCS) >> .depend

# Rule to delete objects and executables and prepare for a clean build	
clean:
	-rm -f *.o
	-rm -f xchkdmp
	
# Rule for creating the xchkdmp executable
xchkdmp : $(OBJS) ../libfs/libfs.a
	$(CC) -o xchkdmp $(OBJS) ../libfs/libfs.a

