#
# Makefile for the Linux JFS XPEEK program
#
#

# We will use the GNU C Compiler
CC = gcc

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

# XPEEK is composed of the following objects and sources
OBJS = alter.o directory.o display.o dmap.o fsckcbbl.o help.o iag.o inode.o io.o super.o super2.o ui.o xpeek.o

SRCS = alter.c directory.c display.c dmap.c fsckcbbl.c help.c iag.c inode.c io.c super.c super2.c ui.c xpeek.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 -D_JFS_UNICODE

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

# Default rule for building xpeek
all: xpeek


# 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 xpeek
	
# Rule for creating the xpeek executable
xpeek : $(OBJS) ../libfs/libfs.a
	$(CC) -o xpeek $(OBJS) ../libfs/libfs.a

