Commit | Line | Data |
---|---|---|
9ac667e6 SR |
1 | # |
2 | # pkgutils | |
3 | # | |
4 | # Copyright (c) 2000-2005 by Per Liden <per@fukt.bth.se> | |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
7 | # it under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
19 | # USA. | |
20 | # | |
21 | ||
22 | DESTDIR = | |
23 | BINDIR = /usr/bin | |
24 | MANDIR = /usr/man | |
25 | ETCDIR = /etc | |
26 | ||
27 | VERSION = 5.21 | |
28 | LIBTAR_VERSION = 1.2.11 | |
29 | ||
30 | CXXFLAGS += -DNDEBUG | |
31 | CXXFLAGS += -O2 -Wall -pedantic -D_GNU_SOURCE -DVERSION=\"$(VERSION)\" \ | |
376786d8 MH |
32 | -Ilibtar-$(LIBTAR_VERSION)/lib -Ilibtar-$(LIBTAR_VERSION)/listhash \ |
33 | -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 | |
9ac667e6 SR |
34 | |
35 | LDFLAGS += -static -Llibtar-$(LIBTAR_VERSION)/lib -ltar -lz | |
36 | ||
37 | OBJECTS = main.o pkgutil.o pkgadd.o pkgrm.o pkginfo.o | |
38 | ||
39 | MANPAGES = pkgadd.8 pkgrm.8 pkginfo.8 pkgmk.8 rejmerge.8 | |
40 | ||
41 | LIBTAR = libtar-$(LIBTAR_VERSION)/lib/libtar.a | |
42 | ||
43 | all: pkgadd pkgmk rejmerge man | |
44 | ||
45 | $(LIBTAR): | |
46 | (tar xzf libtar-$(LIBTAR_VERSION).tar.gz; \ | |
47 | cd libtar-$(LIBTAR_VERSION); \ | |
48 | patch -p1 < ../libtar-$(LIBTAR_VERSION)-fix_mem_leak.patch; \ | |
49 | patch -p1 < ../libtar-$(LIBTAR_VERSION)-reduce_mem_usage.patch; \ | |
50 | patch -p1 < ../libtar-$(LIBTAR_VERSION)-fix_linkname_overflow.patch; \ | |
51 | LDFLAGS="" ./configure --disable-encap --disable-encap-install; \ | |
52 | make) | |
53 | ||
54 | pkgadd: $(LIBTAR) .depend $(OBJECTS) | |
55 | $(CXX) $(OBJECTS) -o $@ $(LDFLAGS) | |
56 | ||
57 | pkgmk: pkgmk.in | |
58 | ||
59 | rejmerge: rejmerge.in | |
60 | ||
61 | man: $(MANPAGES) | |
62 | ||
63 | mantxt: man $(MANPAGES:=.txt) | |
64 | ||
65 | %.8.txt: %.8 | |
66 | nroff -mandoc -c $< | col -bx > $@ | |
67 | ||
68 | %: %.in | |
69 | sed -e "s/#VERSION#/$(VERSION)/" $< > $@ | |
70 | ||
71 | .depend: | |
72 | $(CXX) $(CXXFLAGS) -MM $(OBJECTS:.o=.cc) > .depend | |
73 | ||
74 | ifeq (.depend,$(wildcard .depend)) | |
75 | include .depend | |
76 | endif | |
77 | ||
78 | .PHONY: install clean distclean dist | |
79 | ||
80 | dist: distclean | |
81 | rm -rf /tmp/pkgutils-$(VERSION) | |
82 | mkdir -p /tmp/pkgutils-$(VERSION) | |
3309e1f8 | 83 | git-log > ChangeLog |
9ac667e6 | 84 | cp -rf . /tmp/pkgutils-$(VERSION) |
d7fbaa09 | 85 | tar -C /tmp --exclude .git -czvf ../pkgutils-$(VERSION).tar.gz pkgutils-$(VERSION) |
9ac667e6 SR |
86 | rm -rf /tmp/pkgutils-$(VERSION) |
87 | ||
88 | install: all | |
89 | install -D -m0755 pkgadd $(DESTDIR)$(BINDIR)/pkgadd | |
90 | install -D -m0644 pkgadd.conf $(DESTDIR)$(ETCDIR)/pkgadd.conf | |
91 | install -D -m0755 pkgmk $(DESTDIR)$(BINDIR)/pkgmk | |
92 | install -D -m0755 rejmerge $(DESTDIR)$(BINDIR)/rejmerge | |
93 | install -D -m0644 pkgmk.conf $(DESTDIR)$(ETCDIR)/pkgmk.conf | |
94 | install -D -m0644 rejmerge.conf $(DESTDIR)$(ETCDIR)/rejmerge.conf | |
95 | install -D -m0644 pkgadd.8 $(DESTDIR)$(MANDIR)/man8/pkgadd.8 | |
96 | install -D -m0644 pkgrm.8 $(DESTDIR)$(MANDIR)/man8/pkgrm.8 | |
97 | install -D -m0644 pkginfo.8 $(DESTDIR)$(MANDIR)/man8/pkginfo.8 | |
98 | install -D -m0644 pkgmk.8 $(DESTDIR)$(MANDIR)/man8/pkgmk.8 | |
99 | install -D -m0644 rejmerge.8 $(DESTDIR)$(MANDIR)/man8/rejmerge.8 | |
100 | ln -sf pkgadd $(DESTDIR)$(BINDIR)/pkgrm | |
101 | ln -sf pkgadd $(DESTDIR)$(BINDIR)/pkginfo | |
102 | ||
103 | clean: | |
104 | rm -f .depend | |
105 | rm -f $(OBJECTS) | |
106 | rm -f $(MANPAGES) | |
107 | rm -f $(MANPAGES:=.txt) | |
108 | ||
109 | distclean: clean | |
110 | rm -f pkgadd pkginfo pkgrm pkgmk rejmerge | |
111 | rm -rf libtar-$(LIBTAR_VERSION) | |
112 | ||
113 | # End of file |