-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (74 loc) · 2.35 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# symlookup Makefile
# Copyright © 2007-2011 Andrew Savchenko
#
# This file is part of symlookup.
#
# symlookup is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation
#
# symlookup is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License version 3 for more details.
#
# You should have received a copy of the GNU General Public License version 3
# along with symlookup. If not, see <http://www.gnu.org/licenses/>.
#
include config.mak
.PHONY: all tags clean distclean install uninstall
SRCS = output.c \
parser.c \
scanelf.c \
symlookup.c
ifdef HAVE_RPM
SRCS += rpmutils.c
endif
ifdef HAVE_PORTAGE
SRCS += portageutils.c
endif
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
# remove autogenerated and non-existing headers
HDRS = $(SRCS:.cpp=.h) safemem.h
all: $(DEPS) symlookup
%.d: %.c
$(CC) -MM -MG $< > $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# rpm's fts conflicts with system-wide one,
# so include rpm inc dir only when needed
ifdef HAVE_RPM
rpmutils.o: rpmutils.c rpmutils.h
$(CC) $(CFLAGS) $(RPM_INCFLAGS) -c $< -o $@
endif
symlookup: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) ${LIBS} -o symlookup
$(STRIP)
install:
install -d $(DESTDIR)$(bindir) \
$(DESTDIR)$(docdir)/symlookup-$(VERSION) \
$(DESTDIR)$(mandir)/man1
install -m 0755 symlookup $(DESTDIR)$(bindir)/symlookup
install -m 0644 AUTHORS $(DESTDIR)$(docdir)/symlookup-$(VERSION)
install -m 0644 Changelog $(DESTDIR)$(docdir)/symlookup-$(VERSION)
install -m 0644 LICENSE $(DESTDIR)$(docdir)/symlookup-$(VERSION)
install -m 0644 README $(DESTDIR)$(docdir)/symlookup-$(VERSION)
install -m 0644 TODO $(DESTDIR)$(docdir)/symlookup-$(VERSION)
install -m 0644 symlookup.1 $(DESTDIR)$(mandir)/man1/symlookup.1
tags:
ctags $(SRCS) $(HDRS)
clean:
rm -f $(OBJS) $(DEPS)
distclean: clean
rm -f symlookup config.mak configure.log tags
uninstall:
rm -f $(DESTDIR)$(bindir)/symlookup
rm -rf $(DESTDIR)$(docdir)/symlookup*
rm -f $(DESTDIR)$(mandir)/man1/symlookup.1*
# on distclean per-file deps will be removed anyway
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
-include $(DEPS)
endif
endif