# Makefile for edefrag, the Linux file system defragmenter
#
# Copyright (C) Stephen Tweedie, 1992
# This file may be distributed under the terms of the GNU
# General Public License. 

CC = gcc

#For the brave...
#CFLAGS = -N -O6 -Wall -DNODEBUG
#LDFLAGS = -N -s

#Recommended compiler options
CFLAGS = -Wall -g
LDFLAGS = -g

PROGS = defrag edefrag

all:	$(PROGS)

defrag:		defrag.o minix.o misc.o buffers.o
	gcc $(LDFLAGS) -o $@ $^

edefrag:	edefrag.o ext.o misc.o ebuffers.o
	gcc $(LDFLAGS) -o $@ $^

defrag.o:	defrag.c
	gcc $(CFLAGS) -DMINIXFS -c -o $@ $<

edefrag.o:	defrag.c
	gcc $(CFLAGS) -DEXTFS -c -o $@ $<

buffers.o:	buffers.c
	gcc $(CFLAGS) -DMINIXFS -c -o $@ $<

ebuffers.o:	buffers.c
	gcc $(CFLAGS) -DEXTFS -c -o $@ $<

minix.o:	minix.c
	gcc $(CFLAGS) -DMINIXFS -c -o $@ $<

ext.o:	ext.c
	gcc $(CFLAGS) -DEXTFS -c -o $@ $<

clean:
	rm -f $(PROGS) *.o core tmp_make

tags:
	/usr/emacs/etc/etags *.[ch] README CHANGES INSTALL
dep:
	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
# fudge for extfs dependencies
	$(CPP) -M defrag.c | sed "s/defrag.o/edefrag.o/" >> tmp_make
	$(CPP) -M buffers.c | sed "s/buffers.o/ebuffers.o/" >> tmp_make
	for i in *.c; do $(CPP) -M $$i; done >> tmp_make
	cp tmp_make Makefile

### Dependencies:
