-
Notifications
You must be signed in to change notification settings - Fork 65
/
Makefile.in
172 lines (148 loc) · 5.01 KB
/
Makefile.in
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#
# Copyright (c) 2011-2013 CESNET
#
# LICENSE TERMS
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Company nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# ALTERNATIVELY, provided that this notice is retained in full, this
# product may be distributed under the terms of the GNU General Public
# License (GPL) version 2 or later, in which case the provisions
# of the GPL apply INSTEAD OF those given above.
#
# This software is provided ``as is'', and any express or implied
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose are disclaimed.
# In no event shall the company or contributors be liable for any
# direct, indirect, incidental, special, exemplary, or consequential
# damages (including, but not limited to, procurement of substitute
# goods or services; loss of use, data, or profits; or business
# interruption) however caused and on any theory of liability, whether
# in contract, strict liability, or tort (including negligence or
# otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
#
NAME = netopeer-cli
VERSION = @PACKAGE_VERSION@
RELEASE = @RELEASE@
IDGIT = "built from git $(shell git show --pretty=oneline | head -1 | cut -c -20)"
IDNOGIT = "released as version $(VERSION)"
srcdir = @srcdir@
abs_srcdir = @abs_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datarootdir = @datarootdir@
mandir = @mandir@
readlink = @READLINK@
CC = @CC@
LIBS = @LIBS@
CFLAGS = -Wall @CFLAGS@
CPPFLAGS = @CPPFLAGS@ -DVERSION=\"$(VERSION)\"
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
RPMBUILD = @RPMBUILD@
RPMDIR = RPMBUILD
INCLUDES=
ifeq "$(shell pwd)" "$(shell $(readlink) -f $(srcdir))"
OBJDIR= .obj
else
OBJDIR= .
VPATH = $(srcdir)
endif
SRCS = main.c \
commands.c \
configuration.c \
readinput.c \
test.c
HDRS = commands.h \
configuration.h \
readinput.h \
test.h
OBJS = $(SRCS:%.c=$(OBJDIR)/%.o)
MANPAGES = doc/netopeer-cli.1
MANHTMLS = $(MANPAGES:%=%.html)
MANPATH=$(DESTDIR)$(mandir)/man$(subst .,,$(suffix $(1)))
define MANINSTALL
[ -d $(call MANPATH,$(1)) ] || \
(mkdir -p $(call MANPATH,$(1)); \
chmod 755 $(call MANPATH,$(1))); \
$(INSTALL_DATA) $(1) $(call MANPATH,$(1))/;
endef
all: $(NAME)
$(NAME): $(OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(OBJS) $(LIBS) -o $(NAME)
.PHONY: static
static: $(OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(OBJS) libnetconf.a -lreadline -o $(NAME)
$(OBJDIR)/%.o: %.c
@[ -d $$(dirname $@) ] || \
(mkdir -p $$(dirname $@))
$(CC) $(CFLAGS) $(INCLUDES) $(CPPFLAGS) -fPIC -c $< -o $@
%.1.html: %.1
@if [ "@ROFF2HTML@" = "no" ]; then \
echo "Missing roff2html"; \
else \
@ROFF2HTML@ $< > $@; \
fi
.PHONY: doc
doc: $(MANHTMLS)
.PHONY: tarball
tarball: $(SRCS) $(HEADERS) $(MANHTMLS)
@rm -rf $(NAME)-$(VERSION);
@mkdir $(NAME)-$(VERSION);
for i in $(SRCS) $(HDRS) $(MANPAGES) $(MANHTMLS) configure.in configure \
Makefile.in VERSION $(NAME).spec.in \
install-sh config.sub config.guess; do \
[ -d $(NAME)-$(VERSION)/$$(dirname $$i) ] || (mkdir -p $(NAME)-$(VERSION)/$$(dirname $$i)); \
cp $$i $(NAME)-$(VERSION)/$$i; \
done; \
@rm -rf $(RPMDIR)/SOURCES/; \
mkdir -p $(RPMDIR)/SOURCES/; \
tar -c -z -f $(RPMDIR)/SOURCES/$(NAME)-$(VERSION)-$(RELEASE).tar.gz \
$(NAME)-$(VERSION); \
rm -rf $(NAME)-$(VERSION);
.PHONY: rpm
rpm: tarball
if [ "$(RPMBUILD)" != "no" ]; then \
mkdir -p $(RPMDIR)/BUILD $(RPMDIR)/RPMS $(RPMDIR)/SRPMS; \
$(RPMBUILD) -ba $(NAME).spec \
--define "_topdir `pwd`/$(RPMDIR)"; \
else \
echo "Missing rpmbuild"; \
exit 1; \
fi
.PHONY: install
install: $(NAME) $(MANPAGES) $(MANHTMLS)
[ -d $(DESTDIR)/$(bindir) ] || \
(mkdir -p $(DESTDIR)/$(bindir); chmod 755 $(DESTDIR)/$(bindir))
$(INSTALL_PROGRAM) $(NAME) $(DESTDIR)/$(bindir)/;
$(foreach man,$(MANPAGES),$(call MANINSTALL,$(man)))
if test -n "$(MANHTMLS)"; then \
[ -d $(DESTDIR)/$(datarootdir)/netopeer/ ] || \
(mkdir -p $(DESTDIR)/$(datarootdir)/netopeer/; chmod 755 $(DESTDIR)/$(datarootdir)/netopeer/); \
fi
$(foreach man,$(MANHTMLS),$(INSTALL_DATA) $(man) $(DESTDIR)/$(datarootdir)/netopeer/)
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)/$(bindir)/$(NAME);
$(foreach man,$(MANPAGES),rm -rf $(call MANPATH,$(man))/$(notdir $(man)))
$(foreach man,$(MANHTMLS),rm -rf $(DESTDIR)/$(datarootdir)/netopeer/$(notdir $(man)))
.PHONY: clean
clean:
rm -rf $(NAME) .obj $(OBJS);
.PHONY: cleandoc
cleandoc:
rm -rf $(MANHTMLS);