# Makefile for the Hurd Mboxfs translator.
# Copyright (C) 2002, 2003  Ludovic Courts <ludo@type-z.org>

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


CC      = gcc
CFLAGS  = -D_GNU_SOURCE -Wall -DDEBUG -g -D_FILE_OFFSET_BITS=64
#LDFLAGS = -ldiskfs -liohelp -lfshelp -lstore -lpthread -lports
LDFLAGS = -lnetfs -lfshelp -liohelp -lpthread -lports \
          -lihash -lshouldbeinlibc
INSTALL = install
CTAGS   = ctags

#HURDLIBS = -lpthread -lports -ltrivfs -lfshelp -lpipe -lihash -lshouldbeinlibc
SRC     = main.c netfs.c mboxfs.c fs.c samplefs.c samplefs.c debug.c
OBJ     = $(SRC:%.c=%.o)
TRANS   = mboxfs
HURD    = /hurd

# Name of the test node
TNODE   = tnode

all: $(TRANS) # start-trans

$(TRANS): $(OBJ) mutt/libmutt.a
	$(CC) -o $@ $^ $(LDFLAGS) -Lmutt -lmutt

mutt/libmutt.a:
	$(MAKE) -C mutt

tags: $(SRC)
	$(CTAGS) $(SRC)

start-trans: $(TRANS)
	settrans -ac $(TNODE) ./$(TRANS)

stop-trans:
	settrans -fg $(TNODE)

install: $(TRANS)
	$(INSTALL) -m 555 $(TRANS) $(HURD)

clean:
	$(MAKE) -C mutt clean
	rm -f $(TRANS) $(OBJ) $(TNODE) tags
