CC=gcc
OPTS=-Wall -MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wundef -Wcast-align -Waggregate-return -Wsign-compare -Wbad-function-cast -Wcast-qual -Wtraditional -O2
#--static 
# -g
#-Wconversion
#-pedantic
#-nostdinc 

#-Werror 
#-fstack-check
#s -fomit-frame-pointer
#g
#-fcheck-memory-usage

OUT=./testdisk.exe

test:   $(OUT)
#       $(OUT)

OBJS=lang.o fnctdsk.o hdaccess.o analyse.o testdisk.o fillfree.o godmode.o bsd.o common.o fat.o mbrmanip.o ext2.o bfs.o swap.o netware.o

$(OUT): $(OBJS)
	$(CC) $(OPTS) -o $(OUT) $(OBJS) -lcurso

linux: $(OBJS)
	$(CC) $(OPTS) -o testdisk_linux $(OBJS) -lncurses
#-static -s
#-lccmalloc
#-ldl

mbrmanip.o: mbrmanip.c types.h common.h fnctdsk.h lang.h hdaccess.h
	$(CC) $(OPTS) -c mbrmanip.c

fillfree.o: fillfree.c fillfree.h lang.h makefile common.h testdisk.h fnctdsk.h analyse.h hdaccess.h fat.h
	$(CC) $(OPTS) -c fillfree.c

common.o: common.c common.h
	$(CC) $(OPTS) -c common.c

fat.o: fat.c fat.h
	$(CC) $(OPTS) -c fat.c

bsd.o: bsd.c bsd.h types.h common.h fnctdsk.h
	$(CC) $(OPTS) -c bsd.c

ext2.o: ext2.c ext2.h types.h common.h
	$(CC) $(OPTS) -c ext2.c

bfs.o: bfs.c bfs.h types.h common.h
	$(CC) $(OPTS) -c bfs.c

netware.o: netware.c netware.h types.h common.h
	$(CC) $(OPTS) -c netware.c

swap.o: swap.c swap.h types.h common.h
	$(CC) $(OPTS) -c swap.c

testdisk.o:  testdisk.c testdisk.h lang.h makefile common.h godmode.h
	$(CC) $(OPTS) -c testdisk.c

analyse.o:  analyse.c types.h common.h fnctdsk.h hdaccess.h analyse.h makefile bfs.h testdisk.h swap.h netware.h
	$(CC) $(OPTS) -c analyse.c

godmode.o:  godmode.c common.h fnctdsk.h analyse.h lang.h makefile testdisk.h
	$(CC) $(OPTS) -c godmode.c

fnctdsk.o: fnctdsk.c common.h fnctdsk.h makefile hdaccess.h
	$(CC) $(OPTS) -c fnctdsk.c

lang.o: lang.c makefile
	$(CC) $(OPTS) -c lang.c

hdaccess.o:   hdaccess.c common.h hdaccess.h makefile
	$(CC) $(OPTS) -c hdaccess.c

clean:
	rm -f *.o *~ *.d

zip:
	rm -f testdisk.zip
	zip testdisk.zip *
