summaryrefslogtreecommitdiffstats
path: root/cpgx/Makefile
blob: 94c32665819a364e1d5af19225af4a41e9c08952 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59

CFLAGS := -Wall -g

OPENAIS_CPG := $(wildcard /usr/include/openais/cpg.h)
ifneq ($(strip $(OPENAIS_CPG)),)
CFLAGS += -DWHITETANK
ARCHM=$(shell uname -m)
ifeq (x86_64,$(ARCHM))
LDFLAGS += -L/usr/lib64/openais
else
LDFLAGS := -L/usr/lib/openais
endif
endif

VER=$(shell cat VERSION)
CFLAGS += -DVERSION=\"$(VER)\"

all: cpgx

cpgx:	cpgx.o
	gcc $(LDFLAGS) -o $@ $^ -lcpg

cpgx.o:	cpgx.c
	gcc $(CFLAGS) -c -o $@ $<

clean:
	rm -f *.o cpgx

install: all
	install cpgx $(DESTDIR)/usr/bin

VERSION := $(shell cat VERSION)

ifdef DIST
  RPMDEFS := -D "dist $(DIST)"
endif

tarfiles := cpgx.c list.h cpgx.spec Makefile VERSION
tarball := cpgx-$(VERSION).tar.gz

# to release tarball:
# edit VERSION with new number and without -git
# commit VERSION change
# make tarball, sprm, rpm
# edit VERSION adding -git
# commit VERSION change
# push

$(tarball): $(tarfiles)
	-$(RM) $@
	git archive --format=tar --prefix=cpgx-$(VERSION)/ HEAD^{tree} | gzip > $@

tarball: $(tarball)

rpm: $(tarball) $(tarfiles)
	rpmbuild -ta $< $(RPMDEFS)

srpm: $(tarball) $(tarfiles)
	rpmbuild -ts $< $(RPMDEFS)