1## Makefile for rebuilding 'unsafe backward' data
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4## Copyright (c) 2015, International Business Machines Corporation and
5## others. All Rights Reserved.
6
7##
8## CONFIGURATION:
9## 1. create Makefile.local containing overrides if necessary:
10##    BUILD_ROOT=/home/user/icu-build    (location of 'config.status' etc.)
11##    PATH_VAR=DYLD_LIBRARY_PATH         (if on OSX etc)
12##
13## UPDATING
14## 1.  make 'reset-icu' will reset ICU to 'bootstrap' state, zeroing out source/i18n/collunsafe.h
15## 2.  make 'gen-file'  will generate and test source/i18n/collunsafe.h
16
17subdir=tools/gencolusb
18srcdir=$(shell pwd)
19SOURCE_ROOT=$(shell cd ../.. ; pwd)
20BUILD_ROOT=$(SOURCE_ROOT)
21BUILD_HERE=$(BUILD_ROOT)/$(subdir)
22TOOL=extract_unsafe_backwards
23TEST=verify_uset
24PATH_VAR=LD_LIBRARY_PATH
25
26-include Makefile.local
27
28GEN_FILE=$(SOURCE_ROOT)/i18n/collunsafe.h
29BUILD_OPTS=-I$(SOURCE_ROOT)/common -I$(SOURCE_ROOT)/i18n -L$(BUILD_ROOT)/lib -licuuc -licui18n -licudata
30RUN_OPTS=env $(PATH_VAR)=$(BUILD_ROOT)/lib
31
32reset-icu:
33	>$(GEN_FILE)
34	$(MAKE) -C $(BUILD_ROOT)/i18n
35
36gen-file: reset-icu
37	mkdir -p $(BUILD_HERE)
38	$(CXX) -o $(BUILD_HERE)/$(TOOL) $(srcdir)/$(TOOL).cpp  $(BUILD_OPTS)
39	$(RUN_OPTS) $(BUILD_HERE)/$(TOOL) > $(GEN_FILE) || exit 1
40	$(CXX) -o $(BUILD_HERE)/$(TEST) $(srcdir)/$(TEST).cpp $(BUILD_OPTS)
41	$(RUN_OPTS) $(BUILD_HERE)/$(TEST) || exit 1
42	$(MAKE) -C $(BUILD_ROOT)/i18n
43	$(RUN_OPTS) $(BUILD_HERE)/$(TEST) || exit 1
44
45.PHONY: reset-icu gen-file
46