# src/Makefile.in	-*- Makefile -*-
@MCOMMON@
basedir = $(srcdir)/..
thisdir = src

first_rule: all
dummy:

SRCS =	command.c graphics.c grkelot.c pixmap.c main.c menubar.c \
	misc.c netdisp.c screen.c scrollbar.c utmp.c options.c system.c

OBJS =	command.o graphics.o grkelot.o pixmap.o main.o menubar.o \
	misc.o netdisp.o screen.o scrollbar.o utmp.o options.o system.o

XPMOBJS = command.o graphics.o grkelot.o main.o menubar.o misc.o \
	netdisp.o screen.o scrollbar.o utmp.o options.o system.o

HDRS =	command.h defaults.h feature.h graphics.h grkelot.h \
	main.h menubar.h misc.h rxvtgrx.h screen.h scrollbar.h options.h \
        system.h

#
# Distribution variables
#

DIST = $(HDRS) $(SRCS) Makefile.in gcc-Wall

# inference rules
.c.o:
	$(CC) -c $(CPPFLAGS) $(XINC) -I$(basedir) $(CFLAGS) $<
#-------------------------------------------------------------------------
all: Eterm

Eterm: VERSION.h feature.h $(OBJS) ../libmej/libmej.a
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(XLIB) -lmej -lImlib -lXext -ltiff -lpng -ljpeg -lz -lm

FreeBSD: VERSION.h $(OBJS) ../libmej/libmej.a
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -lutil $(XLIB) -lmej -lImlib -lXext -lpng -ljpeg -lz -lm
	mv FreeBSD Eterm

VERSION.h:
	echo "#define VERSION \""$(VERSION)"\"" > $@;
	echo "#define VERSION_NUM \""$(VERSION_NUM)"\"" >> $@;

feature.h:
	sed 's%@PREFIX@%$(prefix)%g' feature.h.in > feature.h

tags: $(SRCS)
	ctags $(SRCS)

allbin: Eterm

alldoc:

clean:
	$(RMF) Eterm core a.out *.o *.bak *~

realclean: clean
	$(RMF) VERSION.h feature.h tags *.orig *.rej *.patch

distclean: distdepend
	(cd $(srcdir); $(RMF) Eterm *~ *.o core a.out)
	if test $(srcdir) = .; then $(MAKE) realclean; fi
	(cd $(srcdir); $(RMF) Makefile)

install: allbin alldoc
	$(INSTALL_PROGRAM) Eterm $(DESTDIR)$(bindir)/$(binprefix)Eterm

uninstall:
	(cd $(bindir); $(RMF) $(binprefix)Eterm)

distdirs:
	mkdir $(basedir)/../$(VERNAME)/$(thisdir)

distcopy:
	$(CP) $(DIST) $(basedir)/../$(VERNAME)/$(thisdir)

# Semi-automatic generation of dependencies:
# Use gcc -MM because X11 `makedepend' doesn't work on all systems
# and it also includes system headers.
# `semi'-automatic since dependencies are generated at distribution time.

distdepend:
	mv Makefile.in Makefile.in~
	sed "/^# DO NOT DELETE:/,$$ d" Makefile.in~ > Makefile.in
	echo "# DO NOT DELETE: dependency list follows" >> Makefile.in
	gcc -MM $(CPPFLAGS) $(XINC) -I$(basedir) $(SRCS) >> Makefile.in

# -----------------------------------------------------------------------
# DO NOT DELETE: dependency list follows
command.o: command.c main.h VERSION.h ../config.h feature.h misc.h \
 options.h command.h ../libmej/debug.h ../libmej/mem.h graphics.h \
 grx.h grkelot.h menubar.h scrollbar.h screen.h
graphics.o: graphics.c main.h VERSION.h ../config.h feature.h misc.h \
 command.h ../libmej/debug.h graphics.h grx.h screen.h
grkelot.o: grkelot.c ../config.h feature.h grkelot.h
pixmap.o: pixmap.c main.h VERSION.h ../config.h feature.h misc.h \
 ../libmej/debug.h ../libmej/mem.h options.h
main.o: main.c main.h VERSION.h ../config.h feature.h misc.h command.h \
 ../libmej/debug.h ../libmej/mem.h graphics.h grx.h scrollbar.h \
 menubar.h screen.h options.h
menubar.o: menubar.c main.h VERSION.h ../config.h feature.h misc.h \
 menubar.h command.h ../libmej/debug.h ../libmej/mem.h
misc.o: misc.c main.h VERSION.h ../config.h feature.h misc.h \
 ../libmej/debug.h ../libmej/mem.h options.h
netdisp.o: netdisp.c ../config.h feature.h main.h VERSION.h misc.h
screen.o: screen.c main.h VERSION.h ../config.h feature.h misc.h \
 command.h ../libmej/debug.h ../libmej/mem.h graphics.h grx.h screen.h \
 options.h
scrollbar.o: scrollbar.c feature.h ../config.h main.h VERSION.h misc.h \
 scrollbar.h
utmp.o: utmp.c ../config.h feature.h screen.h main.h VERSION.h misc.h
options.o: options.c main.h VERSION.h ../config.h feature.h misc.h \
 ../libmej/debug.h ../libmej/mem.h ../libmej/strings.h \
 ../libmej/global.h ../src/feature.h grkelot.h options.h
system.o: system.c ../config.h feature.h ../libmej/strings.h \
 ../libmej/global.h ../src/feature.h options.h screen.h main.h \
 VERSION.h misc.h system.h
