-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
68 lines (55 loc) · 1.61 KB
/
Makefile
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
60
61
62
63
64
65
66
67
68
NAME := stalld
VERSION := 1.2
INSTALL = install
CC := gcc
CFLAGS := -Wall -O2 -g
LDFLAGS := -ggdb
LIBS := -lpthread
SRC := $(wildcard src/*.c)
HDR := $(wildcard src/*.h)
OBJ := $(SRC:.c=.o)
DIRS := src redhat man tests
FILES := Makefile README.md gpl-2.0.txt
TARBALL := $(NAME)-$(VERSION).tar.xz
UPSTREAM_TARBALLS := fedorapeople.org:~/public_html/
BINDIR := /usr/bin
DATADIR := /usr/share
DOCDIR := $(DATADIR)/doc
MANDIR := $(DATADIR)/man
LICDIR := $(DATADIR)/licenses
.PHONY: all tests
all: stalld tests
stalld: $(OBJ)
$(CC) -o stalld $(LDFLAGS) $(OBJ) $(LIBS)
static: $(OBJ)
$(CC) -o stalld-static $(LDFLAGS) --static $(OBJ) $(LIBS)
tests:
make -C tests
.PHONY: install
install:
$(INSTALL) -m 755 -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(DOCDIR)
$(INSTALL) stalld -m 755 $(DESTDIR)$(BINDIR)
$(INSTALL) README.md -m 644 $(DESTDIR)$(DOCDIR)
$(INSTALL) -m 755 -d $(DESTDIR)$(MANDIR)/man8
$(INSTALL) man/stalld.8 -m 644 $(DESTDIR)$(MANDIR)/man8
$(INSTALL) -m 755 -d $(DESTDIR)$(LICDIR)/$(NAME)
$(INSTALL) gpl-2.0.txt -m 644 $(DESTDIR)$(LICDIR)/$(NAME)
.PHONY: clean tarball redhat push
clean:
@test ! -f stalld || rm stalld
@test ! -f stalld-static || rm stalld-static
@test ! -f src/stalld.o || rm src/stalld.o
@test ! -f $(TARBALL) || rm -f $(TARBALL)
@make -C redhat clean
@make -C tests clean
@rm -rf *~ $(OBJ)
tarball: clean
rm -rf $(NAME)-$(VERSION) && mkdir $(NAME)-$(VERSION)
cp -r $(DIRS) $(FILES) $(NAME)-$(VERSION)
tar -cvJf $(TARBALL) --exclude='*~' $(NAME)-$(VERSION)
rm -rf $(NAME)-$(VERSION)
redhat: tarball
$(MAKE) -C redhat
push: tarball
scp $(TARBALL) $(UPSTREAM_TARBALLS)
make -C redhat push