forked from troglobit/inadyn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (61 loc) · 2.22 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
69
70
71
72
73
74
# Makefile for INADYN, a simple and small ddns client. -*-Makefile-*-
#VERSION ?= $(shell git tag -l | tail -1)
VERSION ?= 1.99.2
NAME = inadyn
EXEC = src/$(NAME)
PKG = $(NAME)-$(VERSION)
ARCHIVE = $(PKG).tar.bz2
MAN5 = inadyn.conf.5
MAN8 = inadyn.8
ROOTDIR ?= $(dir $(shell pwd))
RM ?= rm -f
CC ?= $(CROSS)gcc
prefix ?= /usr/local
sysconfdir ?= /etc
datadir = $(prefix)/share/doc/inadyn
mandir = $(prefix)/share/man
# This magic trick looks like a comment, but works on BSD PMake
#include <config.mk>
include config.mk
BASE_OBJS = src/base64.o src/md5.o src/dyndns.o src/errorcode.o src/get_cmd.o \
src/http_client.o src/ip.o src/main.o src/os_unix.o src/os_windows.o \
src/os.o src/os_psos.o src/tcp.o src/inadyn_cmd.o src/sha1.o
OBJS = $(BASE_OBJS) $(CFG_OBJ) $(EXTRA_OBJS)
CFLAGS = -Iinclude -DVERSION_STRING=\"$(VERSION)\" $(CFG_INC) $(EXTRA_CFLAGS)
CFLAGS += -O2 -W -Wall
LDLIBS += -lresolv $(EXTRA_LIBS)
DISTFILES = README COPYING LICENSE
# Pattern rules
.c.o:
@printf " CC $@\n"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
# Build rules
all: $(EXEC)
$(EXEC): $(OBJS)
@printf " LINK $@\n"
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
install: $(EXEC)
@install -d $(DESTDIR)$(prefix)/sbin
@install -d $(DESTDIR)$(sysconfdir)
@install -d $(DESTDIR)$(datadir)
@install -d $(DESTDIR)$(mandir)/man8
@install -d $(DESTDIR)$(mandir)/man5
@install -m 0755 $(EXEC) $(DESTDIR)$(prefix)/sbin/
@install -m 0644 man/$(MAN5) $(DESTDIR)$(mandir)/man5/$(MAN5)
@install -m 0644 man/$(MAN8) $(DESTDIR)$(mandir)/man8/$(MAN8)
@for file in $(DISTFILES); do \
install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \
done
uninstall:
-@$(RM) $(DESTDIR)$(prefix)/sbin/$(EXEC)
-@$(RM) -r $(DESTDIR)$(datadir)
-@$(RM) $(DESTDIR)$(mandir)/man5/$(MAN5)
-@$(RM) $(DESTDIR)$(mandir)/man8/$(MAN8)
clean:
-@$(RM) $(OBJS) $(EXEC)
distclean:
-@$(RM) $(OBJS) core $(EXEC) *.o *.map .*.d *.out tags TAGS
dist:
@echo "Building bzip2 tarball of $(PKG) in parent dir..."
git archive --format=tar --prefix=$(PKG)/ $(VERSION) | bzip2 >../$(ARCHIVE)
@(cd ..; md5sum $(ARCHIVE) | tee $(ARCHIVE).md5)