# This Makefile is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.

CC = gcc
AWK = gawk
RANLIB = echo 

LIBS = -lXpm -lXm -lXt -lX11
INCDIRS = -I../.. -I../include  -I/usr/local/include -I/usr/freeware/include 
# WARNINGS = -Wall -Wwrite-strings
FONT24 = 
CFLAGS = -g $(WARNINGS) $(INCDIRS) -DFONT24=\"$(FONT24)\"
DLIB = ../lib/libswt.so.0.1
SLIB = ../lib/libswt.a

target: $(SLIB)
#target: $(DLIB) $(SLIB)

OBJS = \
	swt.o \
	browser.o \
	tree.o \
	header.o \
	groupbox.o \
	statusbar.o \
	toolbar.o \
	util.o \
	resload.o

SRCS = $(OBJS:o=c)

DISTFILES = $(SRCS) copy.xbm copy_mask.xbm link.xbm link_mask.xbm \
	    error.xbm error_mask.xbm Makefile.in

$(DLIB):	$(OBJS)
		$(CC) -shared -o $(DLIB) $(OBJS)

$(SLIB):	$(OBJS)
		ar -r $(SLIB) $(OBJS)
		$(RANLIB) $(SLIB)

clean:
		rm -f $(OBJS) $(LIB) *.bak core

dname:
		mkdir ../../`cat ../../.dname`/swt/motif
		ln $(DISTFILES) ../../`cat ../../.dname`/swt/motif

depend:
	cp Makefile Makefile.bak
	$(AWK) "{ print; } /^# DO NOT DELETE/ { exit; }" < Makefile.bak > Makefile
	$(AWK) '{ print } /^# DO NOT DELETE THIS LINE/ { print ""; exit }' < Makefile.bak > Makefile
	if test "$(CC)" = "gcc" ; then \
           mkdep="gcc -MM";\
        else \
           if test "`uname`" = "SunOS" ; then\
              mkdep="$(CC) -xM";\
           else\
              mkdep="$(CC) -M";\
           fi\
        fi;\
        $$mkdep $(INCDIRS) $(SRCS) >> Makefile

# DO NOT DELETE this line -- it's make depend food

swt.o: swt.c ../../config.h ../include/swt.h ../include/keycodes.h \
 ../include/swttypedef.h ../include/swtxinput.h ../../mycsnprintf.h \
 ../../mysnprintf.h copy.xbm copy_mask.xbm link.xbm link_mask.xbm \
 error.xbm error_mask.xbm swt_structs.h
browser.o: browser.c ../../config.h ../include/swt.h \
 ../include/keycodes.h ../include/swttypedef.h
tree.o: tree.c
header.o: header.c
groupbox.o: groupbox.c ../include/swt.h ../include/keycodes.h \
 ../include/swttypedef.h
statusbar.o: statusbar.c ../include/swt.h ../include/keycodes.h \
 ../include/swttypedef.h
toolbar.o: toolbar.c ../../config.h ../include/swt.h \
 ../include/keycodes.h ../include/swttypedef.h
util.o: util.c
resload.o: resload.c
