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

first_rule: all
dummy:

SRCS =	command.c debug.c graphics.c grkelot.c main.c misc.c\
	netdisp.c screen.c scrollbar.c utmp.c xdefaults.c

OBJS =	command.o debug.o graphics.o grkelot.o main.o misc.o\
	netdisp.o screen.o scrollbar.o utmp.o xdefaults.o

HDRS =	command.h debug.h defaults.h feature.h graphics.h grkelot.h\
	main.h misc.h rxvtgrx.h screen.h scrollbar.h xdefaults.h

#
# Distribution variables
#

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

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

rxvt: VERSION.h $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(XLIB)

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

tags: $(SRCS)
	ctags $(SRCS)

allbin: rxvt

alldoc:

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

realclean: clean
	$(RMF) VERSION.h tags

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

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

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

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

distcopy:
	$(CP) $(DIST) $(basedir)/../$(VERNAME)/$(thisdir)
	(cd $(basedir)/../$(VERNAME)/$(thisdir) && ln -s ../install.sh ./)

# 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: ugly dependency list follows" >> Makefile.in
	gcc -MM $(CPPFLAGS) $(XINC) -I$(basedir) $(SRCS) >> Makefile.in

# -----------------------------------------------------------------------
# DO NOT DELETE: ugly dependency list follows
command.o: command.c main.h VERSION.h ./../config.h feature.h misc.h \
 xdefaults.h command.h debug.h graphics.h rxvtgrx.h grkelot.h \
 scrollbar.h screen.h defaults.h
debug.o: debug.c ./../config.h feature.h debug.h
graphics.o: graphics.c main.h VERSION.h ./../config.h feature.h misc.h \
 command.h debug.h graphics.h rxvtgrx.h screen.h
grkelot.o: grkelot.c ./../config.h feature.h grkelot.h
main.o: main.c main.h VERSION.h ./../config.h feature.h misc.h \
 command.h debug.h graphics.h rxvtgrx.h scrollbar.h screen.h \
 xdefaults.h defaults.h
misc.o: misc.c main.h VERSION.h ./../config.h feature.h misc.h
netdisp.o: netdisp.c ./../config.h feature.h
screen.o: screen.c main.h VERSION.h ./../config.h feature.h misc.h \
 command.h debug.h graphics.h rxvtgrx.h screen.h
scrollbar.o: scrollbar.c main.h VERSION.h ./../config.h feature.h \
 misc.h scrollbar.h
utmp.o: utmp.c ./../config.h feature.h
xdefaults.o: xdefaults.c main.h VERSION.h ./../config.h feature.h \
 misc.h debug.h defaults.h grkelot.h xdefaults.h
