summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: aae72f274e8ab8a1066a8cf009001c2760a6a783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

.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) -lxml2
qarsh: qarsh.c $(COMMON) -lxml2 btime.c hbeat.c
qacp: qacp.c $(COMMON) -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

clean:
	$(RM) $(TARGETS)

VERSION := $(shell awk '/^Version:/ { print $$2 }' qarsh.spec)
qarsh-$(VERSION).tar.bz2: qarsh.spec
	-rm $@
	tar cjf $@ .

tarball: qarsh-$(VERSION).tar.bz2

rpm: qarsh-$(VERSION).tar.bz2 qarsh.spec
	rpmbuild -ta $<

srpm: qarsh-$(VERSION).tar.bz2 qarsh.spec
	rpmbuild -ts $<

# Redefine the default compile rule to include target specific parts
%: %.c
	$(LINK.c) $(CFLAGS_$@) $^ $(LIBS_$@) $(LOADLIBES) -o $@