#
# Makefile for xfm using XawPlus 2.1
# Version for S.u.S.E. Linux 5.3
# 
# Roland Krause 1999
# rokrause@aol.com
#

LIB_PATH =	-L../../XawPlus -L/usr/X11/lib		# Libraries for X window
INC_PATH =	-I../../XawPlus -I/usr/X11/include	# Header for X window
LIBRARIES =	-lXawPlus -lXmu -lXext -lXt -lXpm -lX11 -lm

CC =		gcc 
DEFS =		-O2 -m486 -DXPM -DMAGIC_HEADERS

OBJS =		FmAw.o         FmChmod.o      FmErrors.o     FmInfo.o  \
		FmAwActions.o  FmComms.o      FmExec.o       FmMain.o  \
		FmAwCb.o       FmConfirm.o    FmFw.o         FmOps.o   \
		FmAwPopup.o    FmDelete.o     FmFwActions.o  FmPopup.o \
		FmBitmaps.o    FmDirs.o       FmFwCb.o       FmUtils.o \
      		magic.o	       regerror.o     regexp.o       regsub.o

OBJS2 =		xfmtype.o  magic.o  regerror.o  regexp.o  regsub.o

all:		prog man install
prog:		xfm xfmtype man
man:		xfm.1x xfmtype.1

# --- Clean up

clean:
		rm -f *.o *.1x *.1 xfm xfmtype

# --- Install everything: This only works as superuser root

install:
		cp xfm /usr/X11/bin
		cp Xfm /usr/X11/lib/X11/app-defaults

		rm -rf /usr/X11/lib/X11/xfm
		mkdir -p /usr/X11/lib/X11/xfm/bitmaps
		mkdir -p /usr/X11/lib/X11/xfm/pixmaps
		cp -r ../lib/* /usr/X11/lib/X11/xfm

		cp xfm.1x /usr/man/man1
		gzip /usr/man/man1/xfm.1x
		cp xfmtype.1 /usr/man/man1
		gzip /usr/man/man1/xfmtype.1

# --- Build xfm and xfmtype

xfm:		$(OBJS)
		$(CC) -o xfm $(LIB_PATH) $(OBJS) $(LIBRARIES)
		strip xfm

xfmtype:	$(OBJS2)
		$(CC) -o xfmtype $(OBJS2)
		strip xfmtype

.c.o:
		$(CC) $(DEFS) $(INC_PATH) -c $<


# --- Build the manuals

xfm.1x:		xfm.man
		nroff -man xfm.man >xfm.1x

xfmtype.1:	xfmtype.man
		nroff -man xfmtype.man >xfmtype.1


