| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
VERSION=$(shell sed -n <NEWS.adoc '/::/s/^\([0-9][^:]*\).*/\1/p' | head -1) |
| 20 |
|
| 21 |
.PATH: $(.PARSEDIR) |
| 22 |
prefix?=/usr/local |
| 23 |
target=$(DESTDIR)$(prefix) |
| 24 |
parsedir:=$(.PARSEDIR) |
| 25 |
srcdir=$(dir $(abspath $(firstword $(MAKEFILE_LIST))))$(parsedir) |
| 26 |
VPATH=$(srcdir) |
| 27 |
mandir?=$(DESTDIR)$(prefix)/share/man |
| 28 |
|
| 29 |
INSTALL = install |
| 30 |
TAR ?= tar |
| 31 |
BISON ?= bison |
| 32 |
FLEX ?= flex |
| 33 |
A2X ?= a2x |
| 34 |
|
| •35 |
ENV_CFLAGS := $(CFLAGS) |
| 36 |
GCC_WARNINGS1=-Wall -Wpointer-arith -Wstrict-prototypes |
| 37 |
GCC_WARNINGS2=-Wmissing-prototypes -Wmissing-declarations |
| 38 |
GCC_WARNINGS3=-Wno-unused-function -Wno-unused-label -Wno-format-zero-length |
| 39 |
GCC_WARNINGS=$(GCC_WARNINGS1) $(GCC_WARNINGS2) $(GCC_WARNINGS3) |
| 40 |
CFLAGS += $(GCC_WARNINGS) |
| 41 |
CPPFLAGS += -I. -I$(srcdir) |
| 42 |
|
| 43 |
CPPFLAGS += -DVERSION=\"$(VERSION)\" |
| 44 |
|
| 45 |
|
| 46 |
CFLAGS += -pthread |
| 47 |
CPPFLAGS += -DTHREADS |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
CPPFLAGS += -DREDBLACK # Use red-black trees for faster symbol lookup |
| 70 |
CPPFLAGS += -DUSE_MMAP # Use mmap for reading CVS masters |
| 71 |
CPPFLAGS += -DLINESTATS # Keep track of which lines have @ string delimiters |
| 72 |
CPPFLAGS += -DTREEPACK # Reduce memory usage, particularly on large repos |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
CPPFLAGS+=-Drestrict=__restrict__ |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
CFLAGS += -g |
| 88 |
|
| 89 |
|
| •90 |
CFLAGS += $(EXTRA_CFLAGS) $(ENV_CFLAGS) |
| 91 |
|
| 92 |
|
| 93 |
LFLAGS= |
| 94 |
|
| 95 |
OBJS=gram.o lex.o rbtree.o main.o import.o dump.o cvsnumber.o \ |
| 96 |
cvsutil.o revdir.o revlist.o atom.o revcvs.o generate.o export.o \ |
| 97 |
nodehash.o tags.o authormap.o graph.o utils.o collate.o hash.o |
| 98 |
|
| 99 |
all: cvs-fast-export man html |
| 100 |
|
| 101 |
cvs-fast-export: $(OBJS) |
| 102 |
$(CC) $(CFLAGS) $(TARGET_ARCH) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ |
| 103 |
|
| 104 |
$(OBJS): cvs.h cvstypes.h |
| 105 |
revcvs.o cvsutils.o rbtree.o: rbtree.h |
| 106 |
atom.o nodehash.o revcvs.o revdir.o: hash.h |
| 107 |
revdir.o: treepack.c dirpack.c revdir.c |
| 108 |
dump.o export.o graph.o main.o collate.o revdir.o: revdir.h |
| 109 |
|
| 110 |
gram.h gram.c: gram.y |
| 111 |
$(BISON) $(YFLAGS) --defines=gram.h --output-file=gram.c $(srcdir)/gram.y |
| 112 |
lex.h lex.c: lex.l |
| 113 |
$(FLEX) $(LFLAGS) --header-file=lex.h --outfile=lex.c $(srcdir)/lex.l |
| 114 |
|
| 115 |
gram.o: gram.c lex.h gram.h |
| 116 |
import.o: import.c lex.h gram.h |
| 117 |
lex.o: lex.c gram.h |
| 118 |
|
| 119 |
.SUFFIXES: .html .adoc .txt .1 |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
.adoc.1: |
| 125 |
$(A2X) --doctype manpage --format manpage $< |
| 126 |
.adoc.html: |
| 127 |
$(A2X) --doctype manpage --format xhtml -D . $< |
| 128 |
rm -f docbook-xsl.css |
| •129 |
|
| 130 |
reporting-bugs.html: reporting-bugs.adoc |
| 131 |
TZ=UTC asciidoc reporting-bugs.adoc |
| 132 |
|
| 133 |
man: cvs-fast-export.1 cvssync.1 cvsconvert.1 |
| 134 |
|
| 135 |
html: cvs-fast-export.html cvssync.html cvsconvert.html reporting-bugs.html |
| 136 |
|
| 137 |
clean: |
| 138 |
rm -f $(OBJS) gram.h gram.c lex.h lex.c cvs-fast-export |
| 139 |
rm -f *.1 *.html docbook-xsl.css gram.output gmon.out |
| 140 |
rm -f MANIFEST index.html *.tar.gz |
| 141 |
rm -f *.gcno *.gcda |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
check: cvs-fast-export |
| 148 |
-make EXTRA=-q cppcheck pylint |
| 149 |
-shellcheck -f gcc buildprep tests/visualize tests/gitwash tests/incremental.sh |
| 150 |
$(MAKE) -C tests -s -f $(srcdir)tests/Makefile |
| 151 |
|
| 152 |
install: install-bin install-man |
| 153 |
install-bin: cvs-fast-export cvssync cvsconvert |
| 154 |
$(INSTALL) -d "$(target)/bin" |
| 155 |
$(INSTALL) $^ "$(target)/bin" |
| 156 |
install-man: man |
| 157 |
$(INSTALL) -d "$(mandir)/man1" |
| 158 |
$(INSTALL) -m 644 cvs-fast-export.1 "$(mandir)/man1" |
| 159 |
$(INSTALL) -m 644 cvssync.1 "$(mandir)/man1" |
| 160 |
$(INSTALL) -m 644 cvsconvert.1 "$(mandir)/man1" |
| 161 |
uninstall: uninstall-man uninstall-bin |
| 162 |
uninstall-man: |
| 163 |
cd $(mandir)/man1/ && rm -f cvs-fast-export.1 cvssync.1 cvsconvert.1 |
| 164 |
uninstall-bin: |
| 165 |
cd $(target)/bin && rm -f cvs-fast-export cvssync cvsconvert |
| 166 |
|
| 167 |
PROFILE_REPO = ~/software/groff-conversion/groff-mirror/groff |
| 168 |
gmon.out: cvs-fast-export |
| 169 |
find $(PROFILE_REPO) -name '*,v' | cvs-fast-export -k -p >/dev/null |
| 170 |
PROFILE: gmon.out |
| 171 |
gprof cvs-fast-export >PROFILE |
| 172 |
|
| 173 |
version: |
| 174 |
@echo $(VERSION) |
| 175 |
|
| 176 |
|
| 177 |
CSUPPRESSIONS = -U__UNUSED__ -UYYPARSE_PARAM -UYYTYPE_INT16 -UYYTYPE_INT8 \ |
| 178 |
-UYYTYPE_UINT16 -UYYTYPE_UINT8 -UYY_USER_INIT -UYY_READ_BUF_SIZE \ |
| 179 |
-UYY_NO_INPUT -UECHO -UYY_START_STACK_INCR -UYY_FATAL_ERROR \ |
| 180 |
-U_SC_NPROCESSORS_ONLN -Ushort -Usize_t -Uyytext_ptr \ |
| 181 |
-Uyyoverflow -U__cplusplus -U__APPLE__ -DCLOCK_REALTIME=0 |
| 182 |
cppcheck: |
| 183 |
cppcheck -I. --template $(CC) --enable=all $(CSUPPRESSIONS) --suppress=unusedStructMember --suppress=unusedFunction --suppress=unreadVariable --suppress=uselessAssignmentPtrArg --suppress=missingIncludeSystem $(EXTRA) --inline-suppr *.[ch] |
| 184 |
|
| 185 |
PYLINTOPTS = --rcfile=/dev/null --reports=n \ |
| 186 |
--msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \ |
| 187 |
--dummy-variables-rgx='^_' |
| 188 |
PYSUPPRESSIONS = --disable="C0103,C0111,C0301,C0325,C0326,C0410,C0411,C0413,E1305,R0201,R0205,R0801,R0903,R0912,R0913,R0914,W0142,R1705,R1718,R1721,R1724,W0221,W0621" |
| 189 |
pylint: |
| 190 |
@pylint $(PYLINTOPTS) $(PYSUPPRESSIONS) cvssync cvsconvert cvsstrip tests/*.py |
| 191 |
|
| 192 |
|
| 193 |
distclean: clean |
| 194 |
cd tests; $(MAKE) --quiet clean |
| 195 |
|
| 196 |
SOURCES = Makefile *.[ch] *.[yl] cvssync cvsconvert cvsstrip buildprep |
| 197 |
DOCS = control *.adoc cfe-logo.png |
| 198 |
ALL = $(SOURCES) $(DOCS) tests |
| 199 |
cvs-fast-export-$(VERSION).tar.gz: $(ALL) |
| 200 |
$(TAR) --transform='s:^:cvs-fast-export-$(VERSION)/:' --show-transformed-names -cvzf cvs-fast-export-$(VERSION).tar.gz $(ALL) |
| 201 |
|
| 202 |
dist: distclean cvs-fast-export-$(VERSION).tar.gz |
| 203 |
|
| 204 |
release: cvs-fast-export-$(VERSION).tar.gz html |
| 205 |
shipper version=$(VERSION) | sh -e -x |
| 206 |
|
| 207 |
refresh: html |
| 208 |
shipper -N -w version=$(VERSION) | sh -e -x |