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

first_rule: all
dummy:

SRCS =	rxvt.c command.c graphics.c sbar.c screen.c xdefaults.c xsetup.c\
	debug.c grkelot.c netdisp.c utmp.c

OBJS =	rxvt.o command.o graphics.o sbar.o screen.o xdefaults.o xsetup.o\
	debug.o grkelot.o netdisp.o utmp.o

HDRS =	rxvt.h command.h graphics.h sbar.h screen.h xdefaults.h xsetup.h\
	rxvtgrx.h defaults.h feature.h debug.h grkelot.h

#
# Distribution variables
#

DIST = $(HDRS) $(SRCS) Makefile.in

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

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

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

tags: $(SRCS)
	ctags $(SRCS)

allbin: rxvt

alldoc:

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

realclean: clean
	$(RMF) VERSION tags

distclean:
	(cd $(srcdir); $(RMF) Makefile.bak 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)

# 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.

dist_depend:
	gcc -MM $(CPPFLAGS) $(XINC) -I$(basedir) $(SRCS) >> Makefile.in

# -----------------------------------------------------------------------
# Warning: ugly dependency list follows
rxvt.o: rxvt.c rxvt.h VERSION feature.h command.h xsetup.h
command.o: command.c rxvt.h VERSION feature.h command.h debug.h \
 graphics.h rxvtgrx.h grkelot.h sbar.h screen.h xsetup.h
graphics.o: graphics.c rxvt.h VERSION feature.h command.h debug.h \
 graphics.h rxvtgrx.h xsetup.h screen.h
sbar.o: sbar.c rxvt.h VERSION feature.h sbar.h xsetup.h
screen.o: screen.c rxvt.h VERSION feature.h command.h debug.h \
 graphics.h rxvtgrx.h xsetup.h screen.h
xdefaults.o: xdefaults.c rxvt.h VERSION feature.h debug.h grkelot.h \
 xsetup.h xdefaults.h
xsetup.o: xsetup.c rxvt.h VERSION feature.h command.h debug.h \
 graphics.h rxvtgrx.h sbar.h xsetup.h xdefaults.h screen.h defaults.h
debug.o: debug.c feature.h debug.h
grkelot.o: grkelot.c feature.h grkelot.h
netdisp.o: netdisp.c feature.h
utmp.o: utmp.c feature.h
