.PHONY: clean clobber uninstall CFLAGS := -Wall -g -I/usr/include/libxml2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE COMMON := qarsh_packet.c sockutil.c TARGETS := qarshd qarsh qacp btimed btimec all: $(TARGETS) qarshd: qarshd.c $(COMMON) qarsh: qarsh.c $(COMMON) btime.c hbeat.c qacp: qacp.c $(COMMON) qarshd qarsh qacp: LOADLIBES := -lxml2 btimed: btimed.c btimec: btimec.c btime.c install: all install -D qacp $(INSTROOT)/usr/bin/qacp install -D qarsh $(INSTROOT)/usr/bin/qarsh install -D qarshd $(INSTROOT)/usr/sbin/qarshd install -D qarsh.xinetd $(INSTROOT)/etc/xinetd.d/qarsh install -D btimed $(INSTROOT)/usr/sbin/btimed install -D btimec $(INSTROOT)/usr/bin/btimec install -D btimed.xinetd $(INSTROOT)/etc/xinetd.d/btimed install -D qarsh.1 $(INSTROOT)/usr/share/man/man1/qarsh.1 install -D qacp.1 $(INSTROOT)/usr/share/man/man1/qacp.1 install -D btimec.1 $(INSTROOT)/usr/share/man/man1/btimec.1 install -D qarshd.8 $(INSTROOT)/usr/share/man/man8/qarshd.8 install -D btimed.8 $(INSTROOT)/usr/share/man/man8/btimed.8 clean: $(RM) $(TARGETS) VERSION := $(shell awk '/^Version:/ { print $$2 }' qarsh.spec) ifdef DIST RPMDEFS := -D "dist $(DIST)" endif tarfiles := qarsh.spec Makefile tarfiles += $(wildcard *.c *.h) tarfiles += qarsh.1 qacp.1 btimec.1 tarfiles += qarshd.8 btimed.8 tarfiles += *.xinetd qarsh-$(VERSION).tar.bz2: $(tarfiles) -rm $@ tar cjf $@ $^ tarball: qarsh-$(VERSION).tar.bz2 rpm: qarsh-$(VERSION).tar.bz2 qarsh.spec rpmbuild -ta $< $(RPMDEFS) srpm: qarsh-$(VERSION).tar.bz2 qarsh.spec rpmbuild -ts $< $(RPMDEFS) # Redefine the default compile rule to include target specific parts %: %.c $(LINK.c) $(CFLAGS_$@) $^ $(LIBS_$@) $(LOADLIBES) -o $@