| 1 |
|
| 2 |
|
| 3 |
all: |
| 4 |
.PHONY: all |
| 5 |
|
| 6 |
|
| •7 |
GIT_VERSION = unknown |
| 8 |
|
| 9 |
|
| 10 |
ifeq ($(.FEATURES),) |
| 11 |
$(error Sorry, please use a newer version (3.81 or later) of gmake (GNU Make).) |
| 12 |
endif |
| 13 |
MAKE_VERSION := $(shell LANG=C $(MAKE) --version | head -1) |
| 14 |
|
| 15 |
|
| 16 |
GAWK := $(shell which gawk 2>/dev/null || bash -c 'builtin type -P gawk' 2>/dev/null) |
| 17 |
ifneq ($(GAWK),) |
| 18 |
GAWK_VERSION := $(shell LANG=C $(GAWK) --version 2>/dev/null | sed -n '1{/[Gg][Nn][Uu] [Aa][Ww][Kk]/p;}') |
| 19 |
ifeq ($(GAWK_VERSION),) |
| 20 |
$(error Sorry, gawk is found but does not seem to work. Please install a proper version of gawk (GNU Awk).) |
| 21 |
endif |
| 22 |
else |
| 23 |
GAWK := $(shell which awk 2>/dev/null || bash -c 'builtin type -P awk' 2>/dev/null) |
| 24 |
ifeq ($(GAWK),) |
| 25 |
$(error Sorry, gawk/awk could not be found. Please check your PATH environment variable.) |
| 26 |
endif |
| 27 |
GAWK_VERSION := $(shell LANG=C $(GAWK) --version 2>/dev/null | sed -n '1{/[Gg][Nn][Uu] [Aa][Ww][Kk]/p;}') |
| 28 |
ifeq ($(GAWK_VERSION),) |
| 29 |
$(error Sorry, gawk could not be found. Please install gawk (GNU Awk).) |
| 30 |
endif |
| 31 |
endif |
| 32 |
|
| 33 |
MWGPP := $(GAWK) -f make/mwg_pp.awk |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
CP := cp |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
FULLVER := 0.4.0-devel4 |
| 46 |
|
| •47 |
BLE_GIT_COMMIT_ID := unknown |
| 48 |
BLE_GIT_BRANCH := unknown |
| 49 |
|
| 50 |
OUTDIR:=out |
| 51 |
|
| 52 |
outdirs += $(OUTDIR) |
| 53 |
|
| 54 |
outfiles+=$(OUTDIR)/ble.sh |
| 55 |
-include $(OUTDIR)/ble.dep |
| 56 |
|
| 57 |
|
| 58 |
$(OUTDIR)/ble.sh: ble.pp GNUmakefile lib/init-cmap.sh lib/init-bind.sh | $(OUTDIR) |
| 59 |
DEPENDENCIES_PHONY=1 DEPENDENCIES_OUTPUT="$(@:%.sh=%.dep)" DEPENDENCIES_TARGET="$@" \ |
| 60 |
FULLVER=$(FULLVER) \ |
| 61 |
BLE_GIT_COMMIT_ID="$(BLE_GIT_COMMIT_ID)" \ |
| 62 |
BLE_GIT_BRANCH="$(BLE_GIT_BRANCH)" \ |
| 63 |
BUILD_GIT_VERSION="$(GIT_VERSION)" \ |
| 64 |
BUILD_MAKE_VERSION="$(MAKE_VERSION)" \ |
| 65 |
BUILD_GAWK_VERSION="$(GAWK_VERSION)" \ |
| 66 |
$(MWGPP) $< >/dev/null |
| 67 |
.DELETE_ON_ERROR: $(OUTDIR)/ble.sh |
| 68 |
|
| 69 |
GENTABLE := bash make/canvas.c2w.generate-table.sh |
| 70 |
|
| 71 |
src/canvas.c2w.sh: |
| 72 |
$(GENTABLE) c2w |
| 73 |
src/canvas.c2w.musl.sh: make/canvas.c2w.wcwidth.cpp make/canvas.c2w.wcwidth-musl.cpp |
| 74 |
+make -C make canvas.c2w.wcwidth.exe |
| 75 |
make/canvas.c2w.wcwidth.exe table_musl2014 | $(GENTABLE) convert-custom-c2w _ble_util_c2w_musl > $@ |
| 76 |
src/canvas.emoji.sh: |
| 77 |
$(GENTABLE) emoji |
| 78 |
src/canvas.GraphemeClusterBreak.sh: |
| 79 |
$(GENTABLE) GraphemeClusterBreak |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
ble-form.sh: |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
outdirs += $(OUTDIR)/lib |
| 89 |
|
| 90 |
|
| 91 |
outfiles += $(OUTDIR)/lib/keymap.emacs.sh |
| 92 |
outfiles += $(OUTDIR)/lib/keymap.vi.sh |
| 93 |
outfiles += $(OUTDIR)/lib/keymap.vi_digraph.sh |
| 94 |
outfiles += $(OUTDIR)/lib/keymap.vi_digraph.txt |
| 95 |
|
| 96 |
|
| 97 |
outfiles += $(OUTDIR)/lib/init-term.sh |
| 98 |
outfiles += $(OUTDIR)/lib/init-bind.sh |
| 99 |
outfiles += $(OUTDIR)/lib/init-cmap.sh |
| 100 |
outfiles += $(OUTDIR)/lib/init-msys1.sh |
| 101 |
|
| 102 |
|
| 103 |
outfiles += $(OUTDIR)/lib/core-complete.sh |
| 104 |
outfiles += $(OUTDIR)/lib/core-syntax.sh |
| 105 |
outfiles += $(OUTDIR)/lib/core-test.sh |
| 106 |
outfiles += $(OUTDIR)/lib/core-cmdspec.sh |
| 107 |
outfiles += $(OUTDIR)/lib/core-debug.sh |
| 108 |
outfiles += $(OUTDIR)/lib/core-edit.ignoreeof-messages.txt |
| 109 |
outfiles += $(OUTDIR)/lib/core-decode.emacs-rlfunc.txt |
| 110 |
outfiles += $(OUTDIR)/lib/core-decode.vi_imap-rlfunc.txt |
| 111 |
outfiles += $(OUTDIR)/lib/core-decode.vi_nmap-rlfunc.txt |
| 112 |
|
| 113 |
|
| 114 |
outfiles += $(OUTDIR)/lib/vim-surround.sh |
| 115 |
outfiles += $(OUTDIR)/lib/vim-arpeggio.sh |
| 116 |
outfiles += $(OUTDIR)/lib/vim-airline.sh |
| 117 |
|
| 118 |
|
| 119 |
outfiles += $(OUTDIR)/lib/test-bash.sh |
| 120 |
outfiles += $(OUTDIR)/lib/test-main.sh |
| 121 |
outfiles += $(OUTDIR)/lib/test-util.sh |
| 122 |
outfiles += $(OUTDIR)/lib/test-canvas.sh |
| 123 |
outfiles += $(OUTDIR)/lib/test-decode.sh |
| 124 |
outfiles += $(OUTDIR)/lib/test-edit.sh |
| 125 |
outfiles += $(OUTDIR)/lib/test-syntax.sh |
| 126 |
outfiles += $(OUTDIR)/lib/test-complete.sh |
| 127 |
outfiles += $(OUTDIR)/lib/test-keymap.vi.sh |
| 128 |
outfiles += $(OUTDIR)/lib/util.bgproc.sh |
| 129 |
|
| 130 |
$(OUTDIR)/lib/%.sh: lib/%.sh | $(OUTDIR)/lib |
| 131 |
$(CP) $< $@ |
| 132 |
$(OUTDIR)/lib/%.txt: lib/%.txt | $(OUTDIR)/lib |
| 133 |
$(CP) $< $@ |
| 134 |
$(OUTDIR)/lib/core-syntax.sh: lib/core-syntax.sh lib/core-syntax-ctx.def | $(OUTDIR)/lib |
| 135 |
$(MWGPP) $< > $@ |
| 136 |
$(OUTDIR)/lib/init-msys1.sh: lib/init-msys1.sh lib/init-msys1-helper.c | $(OUTDIR)/lib |
| 137 |
$(MWGPP) $< > $@ |
| 138 |
$(OUTDIR)/lib/test-canvas.sh: lib/test-canvas.sh lib/test-canvas.GraphemeClusterTest.sh | $(OUTDIR)/lib |
| 139 |
$(MWGPP) $< > $@ |
| 140 |
$(OUTDIR)/lib/init-cmap.sh: lib/init-cmap.sh | $(OUTDIR)/lib |
| 141 |
$(MWGPP) $< > $@ |
| 142 |
$(OUTDIR)/lib/init-bind.sh: lib/init-bind.sh | $(OUTDIR)/lib |
| 143 |
$(MWGPP) $< > $@ |
| 144 |
|
| 145 |
outfiles += $(OUTDIR)/lib/benchmark.ksh |
| •146 |
$(OUTDIR)/lib/benchmark.ksh: lib/benchmark.ksh src/benchmark.sh | $(OUTDIR)/lib |
| 147 |
$(MWGPP) $< > $@ |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
か削除する |
| 154 |
removedfiles += \ |
| 155 |
keymap/emacs.rlfunc.txt \ |
| 156 |
keymap/emacs.sh \ |
| 157 |
keymap/isearch.sh \ |
| 158 |
keymap/vi.sh \ |
| 159 |
keymap/vi_digraph.sh \ |
| 160 |
keymap/vi_digraph.txt \ |
| 161 |
keymap/vi_imap.rlfunc.txt \ |
| 162 |
keymap/vi_nmap.rlfunc.txt \ |
| 163 |
keymap/vi_test.sh \ |
| 164 |
lib/keymap.vi_test.sh |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
outdirs += $(OUTDIR)/licenses $(OUTDIR)/doc |
| 170 |
outfiles-license += $(OUTDIR)/licenses/LICENSE.md |
| 171 |
ifneq ($(USE_DOC),no) |
| 172 |
outfiles-doc += $(OUTDIR)/doc/README.md |
| 173 |
outfiles-doc += $(OUTDIR)/doc/README-ja_JP.md |
| 174 |
outfiles-doc += $(OUTDIR)/doc/CONTRIBUTING.md |
| 175 |
outfiles-doc += $(OUTDIR)/doc/ChangeLog.md |
| 176 |
outfiles-doc += $(OUTDIR)/doc/Release.md |
| 177 |
endif |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
outfiles-doc-toplevel := \ |
| 196 |
$(filter $(outfiles-doc),$(patsubst %,$(OUTDIR)/doc/%,$(wildcard *.md))) |
| 197 |
$(outfiles-doc-toplevel): $(OUTDIR)/doc/%.md: %.md | $(OUTDIR)/doc |
| 198 |
$(CP) $< $@ |
| 199 |
outfiles-license-toplevel := \ |
| 200 |
$(filter $(outfiles-license),$(patsubst %,$(OUTDIR)/licenses/%,$(wildcard *.md))) |
| 201 |
$(outfiles-license-toplevel): $(OUTDIR)/licenses/%.md: %.md | $(OUTDIR)/licenses |
| 202 |
$(CP) $< $@ |
| 203 |
|
| 204 |
$(OUTDIR)/doc/%: docs/% | $(OUTDIR)/doc |
| 205 |
$(CP) $< $@ |
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
.PHONY: update-contrib |
| 211 |
update-contrib contrib/contrib.mk: |
| 212 |
git submodule update --init --recursive |
| 213 |
|
| 214 |
include contrib/contrib.mk |
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
$(outdirs): |
| 220 |
mkdir -p $@ |
| 221 |
|
| 222 |
build: contrib/contrib.mk $(outfiles) $(outfiles-doc) $(outfiles-license) |
| 223 |
.PHONY: build |
| 224 |
|
| 225 |
all: build |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
ifneq ($(INSDIR),) |
| 235 |
INSDIR_LICENSE := $(INSDIR)/licenses |
| 236 |
INSDIR_DOC := $(INSDIR)/doc |
| 237 |
else |
| 238 |
ifneq ($(DESTDIR),) |
| 239 |
DATADIR := $(abspath $(DESTDIR)/$(PREFIX)/share) |
| 240 |
else ifneq ($(PREFIX),) |
| 241 |
DATADIR := $(abspath $(PREFIX)/share) |
| 242 |
else ifneq ($(XDG_DATA_HOME),) |
| 243 |
DATADIR := $(abspath $(XDG_DATA_HOME)) |
| 244 |
else |
| 245 |
DATADIR := $(abspath $(HOME)/.local/share) |
| 246 |
endif |
| 247 |
|
| 248 |
INSDIR := $(DATADIR)/blesh |
| 249 |
INSDIR_LICENSE := $(DATADIR)/blesh/licenses |
| 250 |
INSDIR_DOC := $(DATADIR)/doc/blesh |
| 251 |
endif |
| 252 |
|
| 253 |
ifneq ($(strip_comment),) |
| 254 |
opt_strip_comment := --strip-comment=$(strip_comment) |
| 255 |
else |
| 256 |
opt_strip_comment := |
| 257 |
endif |
| 258 |
|
| 259 |
insfiles := $(outfiles:$(OUTDIR)/%=$(INSDIR)/%) |
| 260 |
insfiles-license := $(outfiles-license:$(OUTDIR)/licenses/%=$(INSDIR_LICENSE)/%) |
| 261 |
insfiles-doc := $(outfiles-doc:$(OUTDIR)/doc/%=$(INSDIR_DOC)/%) |
| 262 |
|
| 263 |
install-files := \ |
| 264 |
$(insfiles) $(insfiles-license) $(insfiles-doc) \ |
| 265 |
$(INSDIR)/cache.d $(INSDIR)/run |
| 266 |
install: $(install-files) |
| 267 |
uninstall: |
| 268 |
bash make_command.sh uninstall $(install-files) |
| 269 |
.PHONY: install uninstall |
| 270 |
|
| 271 |
$(insfiles): $(INSDIR)/%: $(OUTDIR)/% |
| 272 |
bash make_command.sh install $(opt_strip_comment) "$<" "$@" |
| 273 |
$(insfiles-license): $(INSDIR_LICENSE)/%: $(OUTDIR)/licenses/% |
| 274 |
bash make_command.sh install "$<" "$@" |
| 275 |
$(insfiles-doc): $(INSDIR_DOC)/%: $(OUTDIR)/doc/% |
| 276 |
bash make_command.sh install "$<" "$@" |
| 277 |
$(INSDIR)/cache.d $(INSDIR)/run: |
| 278 |
mkdir -p $@ && chmod a+rwxt $@ |
| 279 |
|
| 280 |
clean: |
| 281 |
-rm -rf $(outfiles) $(outfiles-doc) $(outfiles-license) $(OUTDIR)/ble.dep |
| 282 |
.PHONY: clean |
| 283 |
|
| 284 |
dist: $(outfiles) $(outfiles-doc) $(outfiles-license) |
| 285 |
FULLVER=$(FULLVER) bash make_command.sh dist $^ |
| 286 |
.PHONY: dist |
| 287 |
|
| 288 |
dist_excludes= \ |
| 289 |
--exclude=./ble/backup \ |
| 290 |
--exclude=*~ \ |
| 291 |
--exclude=./ble/.git \ |
| 292 |
--exclude=./ble/out \ |
| 293 |
--exclude=./ble/dist \ |
| 294 |
--exclude=./ble/ble.sh |
| 295 |
dist.date: |
| 296 |
cd .. && tar cavf "$$(date +ble.%Y%m%d.tar.xz)" ./ble $(dist_excludes) |
| 297 |
.PHONY: dist.date |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
define DeclareMakeCommand |
| 302 |
$1: $2 |
| 303 |
bash make_command.sh $1 |
| 304 |
.PHONY: $1 |
| 305 |
endef |
| 306 |
|
| 307 |
$(eval $(call DeclareMakeCommand,ignoreeof-messages,)) |
| 308 |
$(eval $(call DeclareMakeCommand,scan,)) |
| 309 |
$(eval $(call DeclareMakeCommand,check,build)) |
| 310 |
$(eval $(call DeclareMakeCommand,check-all,build)) |
| 311 |
$(eval $(call DeclareMakeCommand,list-functions,)) |