CC = gcc

MANDIR=/usr/man/man1
BINDIR=/usr/bin/X11
USRLIBDIR=/usr/lib/X11
INCROOT=/usr/include

#If you want the Shaped window extensions, uncomment these lines
# Shaped window extensions seem to increase the window managers RSS
# by about 60 Kbytes. They provide for leaving a title-bar on the window
# without a border.
# if you dont use shaped window extension, you can either make all your shaped
# windows undecorated, or live with a border and backdrop around all
# your shaped windows (oclock, xeyes)
#
# If you normally use a shaped window (xeyes or oclock), you might as
# well compile this extension in, since the memory cost is  minimal in
# this case (The shaped window shared libs will be loaded anyway. If you
# don't normally use a shaped window, you have to decide for yourself
SHAPEFLAG = -DSHAPE
SHAPELIB = -lXext

# if you want color icons, you can uncomment these lines, and get libXpm
# from sunsite.unc.edu. The following files are recommended in addition
# to the fvwm package:
#   /pub/X11/contrib/xpm-3.2g.tar.Z for the Xpm library, or
#   /pub/Linux/X11/libs, file libXpm32g.tar.z. for a pre-compiled shared 
#                       library of libXpm for Linux.
#   /pub/X11/contrib/xpm1icons.tar.Z, sample icons
#   /pub/X11/contrib/xpm2icons.tar.Z, more sample icons
#   /pub/X11/contrib/xpm3icons.tar.Z, still more sample icons
#   /pub/X11/contrib/ctwm-3.0.tar.Z, pull out the icons. ctwm has really nice
#                                  color icons.
#
# For monochrome, Xpm icons still work, but they're no better than regular
# pixmaps.
XPMFLAG = -DXPM
XPMLIB = -lXpm


# for most systems
LIBS= -L$(USRLIBDIR) $(SHAPELIB) $(XPMLIB) -lX11 
#for solaris 2
#LIBS= -L$(USRLIBDIR) $(SHAPELIB) $(XPMLIB) -lX11 -lsocket -L/usr/ucblib -lucb -lelf -R/usr/ucblib

INITDIR=$(USRLIBDIR)/fvwm

# If you want to make a really small window manager,
# uncomment some or all of these:
# NO_PAGER - Omits the code for the pager
# NON_VIRTUAL - Omits the virtual desktop - requires NO_PAGER
# NO_ICONS - Omits icon drawing (You have the use the window list)
#EF1 = -DNO_PAGER -DNON_VIRTUAL  -DNO_ICONS

# Here are some user preference configuration options:
# 1. Stubborn Placement:
#    If this flag is set, fvwm will not auto-place icons underneath active windows.
#    Normally auto-placement igonores active windows, but makes sure that icons
#    don't overlap
# 2. CurculateSkipIcons:
#    Causes circulate Up/Down to skip over icons.
# 3. Opaque Resize:
#    Might be nice for fast servers
#EF2 = -DSTUBBORN_PLACEMENT -DCIRCULATESKIPICONS -DOPAQUE_RESIZE

#If your libraries don't have sysconf(), uncomment this line 
#EF3 = -DNO_SYSCONF

EXTRAFLAGS = $(EF1) $(EF2) $(EF3) 



FFLAGS = $(MORE_FLAGS) $(SHAPEFLAG) $(XPMFLAG) $(EXTRAFLAGS) -DFVWMRC=\"$(INITDIR)/system.fvwmrc\"

COPTS = -O2 -s 
CFLAGS = $(COPTS) -I$(INCROOT) $(FFLAGS)

SRCS = fvwm.c configure.c events.c borders.c menus.c functions.c resize.c \
        add_window.c pager.c move.c icons.c windows.c
OBJS = fvwm.o configure.o events.o borders.o menus.o functions.o resize.o \
	add_window.o pager.o move.o icons.o windows.o

fvwm: $(OBJS)
	$(CC) $(CFLAGS) -o fvwm $(OBJS) $(LIBS) 

install: $(BINDIR)/fvwm $(MANDIR)/fvwm.1 $(INITDIR)/system.fvwmrc
	@echo You may want to copy system.fvwmrc to each users ~/.fwmrc
	@echo

	@echo Also, remember to change the last line of $(USRLIBDIR)/xinit/xinitrc
	@echo  from \"twm\" or \"exec twm\" echo to \"exec fvwm\"
$(MANDIR)/fvwm.1: fvwm.1
	install -c -m 644 $? $@

$(BINDIR)/fvwm: fvwm
	install -c -m 755 $? $@

$(INITDIR)/system.fvwmrc: $(INITDIR) system.fvwmrc
	install -c -m 644 system.fvwmrc $@

$(INITDIR):
	mkdir $(INITDIR)

clean:
	rm -f $(OBJS)
	rm -f fvwm
	rm -f *~

add_window.o: add_window.c fvwm.h screen.h misc.h menus.h
events.o:     events.c     fvwm.h screen.h misc.h menus.h parse.h
menus.o:      menus.c      fvwm.h screen.h misc.h menus.h parse.h 
resize.o:     resize.c     fvwm.h screen.h misc.h menus.h
fvwm.o:       fvwm.c       fvwm.h screen.h misc.h menus.h
configure.o:  configure.c  fvwm.h screen.h misc.h menus.h
functions.o:  functions.c  fvwm.h screen.h misc.h menus.h parse.h 
move.o:       move.c       fvwm.h screen.h misc.h menus.h parse.h 
borders.o:    borders.c    fvwm.h screen.h misc.h menus.h parse.h 
pager.o:      pager.c      fvwm.h screen.h misc.h menus.h parse.h 
icons.o:      icons.c      fvwm.h screen.h misc.h menus.h parse.h 
windows.o:    windows.c    fvwm.h screen.h misc.h menus.h parse.h 
