#
# Makefile for StegFS components
#

CC = gcc
CFLAGS = -Wall
# CFLAGS = -g -Wall -DDEVEL_ZEROFILL
AR = ar rc
CIPHEROBJS = serpent.o rc6.o mars.o
OLDPROGS = stegfslevel addlevel
MAINPROGS = mkstegfs rerepl stegfsopen stegfsclose stegfsctrl tunestegfs $(OLDPROGS)
DEVPROGS = readdata junkblock inolist

all: $(MAINPROGS)
devtools: $(DEVPROGS)

mkstegfs: mkstegfs.o stegfs.o sha1.o $(CIPHEROBJS)
	$(CC) $(CFLAGS) -o mkstegfs mkstegfs.o stegfs.o sha1.o $(CIPHEROBJS) \
	-lext2fs

mkstegfs.o: mkstegfs.c stegfs.h

stegfs.o: stegfs.c stegfs.h sha1.h crypto.h

sha1.o: sha1.c sha1.h

serpent.o: serpent.c crypto.h

rc6.o: rc6.c crypto.h

mars.o: mars.c crypto.h

readdata: readdata.o stegfs.o sha1.o $(CIPHEROBJS)
	$(CC) $(CFLAGS) -o readdata readdata.o stegfs.o sha1.o $(CIPHEROBJS) \
	-lext2fs

readdata.o: readdata.c stegfs.h

inolist: inolist.o stegfs.o sha1.o $(CIPHEROBJS)
	$(CC) $(CFLAGS) -o inolist inolist.o stegfs.o sha1.o $(CIPHEROBJS) \
	-lext2fs

inolist.o: inolist.c stegfs.h

junkblock: junkblock.o
	$(CC) $(CFLAGS) -o junkblock junkblock.o

rerepl: rerepl.o
	$(CC) $(CFLAGS) -o rerepl rerepl.o

stegfslevel: stegfslevel.o
	$(CC) $(CFLAGS) -o stegfslevel stegfslevel.o

stegfsopen: stegfsopen.o
	$(CC) $(CFLAGS) -o stegfsopen stegfsopen.o

stegfsclose: stegfsclose.o
	$(CC) $(CFLAGS) -o stegfsclose stegfsclose.o

stegfsctrl: stegfsctrl.o stegfs.o sha1.o $(CIPHEROBJS)
	$(CC) $(CFLAGS) -o stegfsctrl stegfsctrl.o stegfs.o sha1.o \
	$(CIPHEROBJS) -lext2fs

stegfsctrl.o: stegfsctrl.c stegfs.h

tunestegfs: tunestegfs.o
	$(CC) $(CFLAGS) -o tunestegfs tunestegfs.o

addlevel: addlevel.o stegfs.o sha1.o $(CIPHEROBJS)
	$(CC) $(CFLAGS) -o addlevel addlevel.o stegfs.o sha1.o $(CIPHEROBJS) \
	-lext2fs

addlevel.o: addlevel.c stegfs.h

clean:
	rm -f *~ *.o *.so *.a $(MAINPROGS) $(DEVPROGS) a.out


