include ../VERSION

# Linux
CXX         = g++
LD          = gcc
CXXOPTS     = -pipe $(WARN)
INCSDIR     = -I/usr/X11R6/include
LIBSDIR     = -L/usr/X11R6/lib

#XPMINCDIR   = -I../../include
#XPMLIBDIR   = -L../../lib

# HPUX
#CXX         = g++
#LD          = gcc
#CXXOPTS     = -pipe $(WARN)
#INCSDIR     = -I/usr/include/X11R5
#LIBSDIR     = -L/usr/lib/X11R5
#for HPUX 9.x
#SYSDEF      = -DHPUX9

# SGI IRIX
#CXX         = CC
#LD          = CC
#CXXOPTS     = 
#INCSDIR     = -I/usr/include/X11R5
#LIBSDIR     = -L/usr/lib/X11R5
#SYSDEF      = -DNEED_BOOL -D_ABI_SOURCE

# where the config files are, overriden by upper makefile
LIBDIR      =../lib
ETCDIR      =../lib

SHAPEDEF    = -DSHAPE
SHAPELIB    = -lXext

DEBUG       = -DDEBUG

# executable extenstion
EXEEXT=

DEFINES     = \
	$(SYSDEF) $(XPMINCDIR) $(SHAPEDEF) $(DEBUG) $(OS2)\
	-DLIBPATH='"$(LIBDIR)"' \
	-DETCPATH='"$(ETCDIR)"' \
	-DVERSION='"$(VERSION)"'

#OPTIMIZE   = -g
#OPTIMIZE   = -O -g
#OPTIMIZE   = -O -g -pg
OPTIMIZE   = -O
#OPTIMIZE   = -O2
#OPTIMIZE   = -O -s
#OPTIMIZE   = -O2 -s

WARN        = -pedantic -W -Wall -Wpointer-arith \
              -Wconversion -Wwrite-strings \
              -Wmissing-prototypes -Wmissing-declarations \
              -Winline

CXXFLAGS    = $(OPTIMIZE) $(CXXOPTS) $(DEFINES) $(INCSDIR)
LFLAGS      = $(OPTIMIZE) $(LIBSDIR)

OBJS        = \
        icewm.o misc.o option.o scrollbar.o dialogs.o winlist.o  \
        mailbox.o window.o root.o frame.o title.o button.o \
        client.o menu.o status.o switch.o movesize.o taskbar.o \
        decorate.o graphics.o icons.o tooltip.o clock.o

ICESOUNDOBJS = icesound.o misc.o 

LIBS        = $(XPMLIBDIR) -lXpm $(SHAPELIB) -lX11

PROGRAMS    = icewm$(EXEEXT) #icesound$(EXEEXT)

.SUFFIXES:
.SUFFIXES: .cc .o .h

.cc.o:
	$(CXX) $(CXXFLAGS) -c $<

all: $(PROGRAMS)

clean:
	rm -f $(PROGRAMS) *.o *~ 

icewm$(EXEEXT): $(OBJS)
	$(LD) -o icewm$(EXEEXT) $(LFLAGS) $(OBJS) $(LIBS)

icesound$(EXEEXT): $(ICESOUNDOBJS)
	$(LD) -o icesound$(EXEEXT) $(LFLAGS) $(ICESOUNDOBJS) $(LIBS)

depend:
	gccmakedep *.cc

# DO NOT DELETE
button.o: button.cc icewm.h config.h MwmUtil.h default.h guievent.h

client.o: client.cc icewm.h config.h MwmUtil.h default.h guievent.h

decorate.o: decorate.cc icewm.h config.h MwmUtil.h default.h guievent.h

frame.o: frame.cc icewm.h config.h MwmUtil.h default.h guievent.h

graphics.o: graphics.cc icewm.h config.h MwmUtil.h default.h guievent.h

icesound.o: icesound.cc guievent.h

icewm.o: icewm.cc icewm.h config.h MwmUtil.h default.h guievent.h

icons.o: icons.cc icewm.h config.h MwmUtil.h default.h guievent.h

mailbox.o: mailbox.cc icewm.h config.h MwmUtil.h default.h guievent.h

menu.o: menu.cc icewm.h config.h MwmUtil.h default.h guievent.h

misc.o: misc.cc icewm.h config.h MwmUtil.h default.h guievent.h

movesize.o: movesize.cc icewm.h config.h MwmUtil.h  default.h guievent.h

option.o: option.cc icewm.h config.h MwmUtil.h default.h guievent.h

root.o: root.cc icewm.h config.h MwmUtil.h default.h guievent.h

status.o: status.cc icewm.h config.h MwmUtil.h default.h guievent.h

switch.o: switch.cc icewm.h config.h MwmUtil.h default.h guievent.h

taskbar.o: taskbar.cc icewm.h config.h MwmUtil.h default.h guievent.h

title.o: title.cc icewm.h config.h MwmUtil.h default.h guievent.h

window.o: window.cc icewm.h config.h MwmUtil.h default.h guievent.h

winlist.o: winlist.cc icewm.h config.h MwmUtil.h default.h guievent.h

dialogs.o: dialogs.cc icewm.h config.h MwmUtil.h default.h guievent.h

scrollbar.o: scrollbar.cc icewm.h config.h MwmUtil.h default.h guievent.h

