mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-1861 samples updated to use icu-config - and also refactored, cleaned up
X-SVN-Rev: 8593
This commit is contained in:
parent
e8462860d1
commit
4395612ac3
17 changed files with 231 additions and 499 deletions
|
@ -20,6 +20,7 @@ include @platform_make_fragment@
|
|||
CLEANFILES = *~
|
||||
|
||||
SUBDIRS = date cal
|
||||
ALLSUBDIRS = datefmt msgfmt numfmt props translit ucnv udata ufortune uresb ustring
|
||||
|
||||
## List of phony targets
|
||||
.PHONY : all all-local all-recursive install install-local \
|
||||
|
@ -37,6 +38,10 @@ clean: clean-recursive clean-local
|
|||
distclean : distclean-recursive distclean-local
|
||||
dist: dist-recursive dist-local
|
||||
|
||||
all-samples: all-samples-recursive
|
||||
clean-samples: clean-samples-recursive
|
||||
check-samples: check-samples-recursive
|
||||
|
||||
# Note (srl 4/15/2002) do NOT recursively check samples for 2.1, look into testing them in the future.
|
||||
#check: all check-recursive check-local
|
||||
check: all check-local
|
||||
|
@ -60,6 +65,25 @@ all-recursive install-recursive clean-recursive distclean-recursive dist-recursi
|
|||
$(MAKE) "$$target-local" || exit; \
|
||||
fi
|
||||
|
||||
all-samples-recursive check-samples-recursive clean-samples-recursive:
|
||||
@dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
subtarget=`echo $@ | sed s/-samples-recursive//`; \
|
||||
list='$(SUBDIRS) $(ALLSUBDIRS)'; for subdir in $$list; do \
|
||||
echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$subtarget' in \`$$subdir'"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$subtarget-local"; \
|
||||
else \
|
||||
local_target="$$subtarget"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $$local_target) || exit; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) "$$subtarget-local" || exit; \
|
||||
fi
|
||||
|
||||
|
||||
all-local:
|
||||
|
||||
install-local:
|
||||
|
|
|
@ -58,7 +58,7 @@ distclean-local: clean-local
|
|||
$(RMV) Makefile
|
||||
|
||||
check-local:
|
||||
-$(INVOKE) $(TARGET)
|
||||
-$(INVOKE) ./$(TARGET)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
|
|
|
@ -62,7 +62,7 @@ distclean-local: clean-local
|
|||
$(RMV) Makefile
|
||||
|
||||
check-local:
|
||||
-$(INVOKE) $(TARGET)
|
||||
-$(INVOKE) ./$(TARGET)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
|
|
|
@ -1,68 +1,20 @@
|
|||
# Copyright (c) 2000 IBM, Inc. and others
|
||||
# Copyright (c) 2000-2002 IBM, Inc. and others
|
||||
# sample code makefile
|
||||
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change the following line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/share/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
#
|
||||
# - configure, build, install ICU (make install)
|
||||
# - make sure "icu-config" (in the ICU installed bin directory) is on
|
||||
# the path
|
||||
# - do 'make' in this directory
|
||||
|
||||
ICU_DEFAULT_PREFIX=~/icu
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_INC=$(ICU_DEFAULT_PREFIX)/lib/icu/Makefile.inc
|
||||
else
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
endif
|
||||
ICUPATH=
|
||||
|
||||
include $(ICU_INC)
|
||||
|
||||
# Name of your target
|
||||
TARGET=datefmt
|
||||
|
||||
# All object files (C or C++)
|
||||
OBJECTS=main.o util.o
|
||||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
# Load in standard makefile definitions
|
||||
include ../defs.mk
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
# Can change this to LINK.c if it is a C only program
|
||||
# Can add more libraries here.
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
$(INVOKE) ./$(TARGET) | tee $(TARGET).out
|
||||
|
||||
# Make report: creates a 'report file' with both source and sample run
|
||||
report: $(TARGET).report
|
||||
|
||||
$(TARGET).report: check $(TARGET).cpp
|
||||
more $(TARGET).cpp $(TARGET).out > $@
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile) and the README"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
# the actual rules (this is a simple sample)
|
||||
include ../rules.mk
|
||||
|
|
|
@ -11,10 +11,17 @@ CPPFLAGS=$(shell icu-config --cppflags)
|
|||
CFLAGS=$(shell icu-config --cflags)
|
||||
CXXFLAGS=$(shell icu-config --cxxflags)
|
||||
LDFLAGS =$(shell icu-config --ldflags)
|
||||
LDFLAGS_USTDIO =$(shell icu-config --ldflags-ustdio)
|
||||
INVOKE=$(shell icu-config --invoke)
|
||||
GENRB=$(shell icu-config --invoke=genrb)
|
||||
PKGDATA=$(shell icu-config --invoke=pkgdata)
|
||||
SO=$(shell icu-config --so)
|
||||
PKGDATAOPTS=-v -d .
|
||||
# default - resources in same mode as ICU
|
||||
RESMODE=$(shell icu-config --icudata-mode)
|
||||
|
||||
####################################################################
|
||||
### Project independent things (common)
|
||||
### We depend on gmake for the bulk of the work
|
||||
|
||||
# link with C++ compiler
|
||||
LINK.o=$(LINK.cc)
|
||||
RMV=rm -rf
|
|
@ -1,68 +1,22 @@
|
|||
# Copyright (c) 2000 IBM, Inc. and others
|
||||
# Copyright (c) 2000-2002 IBM, Inc. and others
|
||||
# sample code makefile
|
||||
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change the following line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/share/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
#
|
||||
# - configure, build, install ICU (make install)
|
||||
# - make sure "icu-config" (in the ICU installed bin directory) is on
|
||||
# the path
|
||||
# - do 'make' in this directory
|
||||
|
||||
ICU_DEFAULT_PREFIX=~/icu
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_INC=$(ICU_DEFAULT_PREFIX)/lib/icu/Makefile.inc
|
||||
else
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
endif
|
||||
ICUPATH=
|
||||
|
||||
include $(ICU_INC)
|
||||
|
||||
#### definitions
|
||||
# Name of your target
|
||||
TARGET=msgfmt
|
||||
|
||||
# All object files (C or C++)
|
||||
OBJECTS=main.o util.o
|
||||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
#### rules
|
||||
# Load in standard makefile definitions
|
||||
include ../defs.mk
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
# Can change this to LINK.c if it is a C only program
|
||||
# Can add more libraries here.
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
$(INVOKE) ./$(TARGET) | tee $(TARGET).out
|
||||
|
||||
# Make report: creates a 'report file' with both source and sample run
|
||||
report: $(TARGET).report
|
||||
|
||||
$(TARGET).report: check $(TARGET).cpp
|
||||
more $(TARGET).cpp $(TARGET).out > $@
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile) and the README"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
# the actual rules (this is a simple sample)
|
||||
include ../rules.mk
|
||||
|
|
|
@ -1,68 +1,22 @@
|
|||
# Copyright (c) 2000 IBM, Inc. and others
|
||||
# Copyright (c) 2000-2002 IBM, Inc. and others
|
||||
# sample code makefile
|
||||
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change the following line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/share/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
#
|
||||
# - configure, build, install ICU (make install)
|
||||
# - make sure "icu-config" (in the ICU installed bin directory) is on
|
||||
# the path
|
||||
# - do 'make' in this directory
|
||||
|
||||
ICU_DEFAULT_PREFIX=~/icu
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_INC=$(ICU_DEFAULT_PREFIX)/lib/icu/Makefile.inc
|
||||
else
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
endif
|
||||
ICUPATH=
|
||||
|
||||
include $(ICU_INC)
|
||||
|
||||
#### definitions
|
||||
# Name of your target
|
||||
TARGET=numfmt
|
||||
|
||||
# All object files (C or C++)
|
||||
OBJECTS=main.o util.o capi.o
|
||||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
#### rules
|
||||
# Load in standard makefile definitions
|
||||
include ../defs.mk
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
# Can change this to LINK.c if it is a C only program
|
||||
# Can add more libraries here.
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
$(INVOKE) ./$(TARGET) | tee $(TARGET).out
|
||||
|
||||
# Make report: creates a 'report file' with both source and sample run
|
||||
report: $(TARGET).report
|
||||
|
||||
$(TARGET).report: check $(TARGET).cpp
|
||||
more $(TARGET).cpp $(TARGET).out > $@
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile) and the README"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
# the actual rules (this is a simple sample)
|
||||
include ../rules.mk
|
||||
|
|
|
@ -1,68 +1,22 @@
|
|||
# Copyright (c) 2000 IBM, Inc. and others
|
||||
# Copyright (c) 2000-2002 IBM, Inc. and others
|
||||
# sample code makefile
|
||||
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change the following line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/share/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
#
|
||||
# - configure, build, install ICU (make install)
|
||||
# - make sure "icu-config" (in the ICU installed bin directory) is on
|
||||
# the path
|
||||
# - do 'make' in this directory
|
||||
|
||||
ICU_DEFAULT_PREFIX=~/icu
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_INC=$(ICU_DEFAULT_PREFIX)/lib/icu/Makefile.inc
|
||||
else
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
endif
|
||||
ICUPATH=
|
||||
|
||||
include $(ICU_INC)
|
||||
|
||||
#### definitions
|
||||
# Name of your target
|
||||
TARGET=props
|
||||
|
||||
# All object files (C or C++)
|
||||
OBJECTS=props.o
|
||||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
#### rules
|
||||
# Load in standard makefile definitions
|
||||
include ../defs.mk
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
# Can change this to LINK.c if it is a C only program
|
||||
# Can add more libraries here.
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
$(INVOKE) ./$(TARGET) | tee $(TARGET).out
|
||||
|
||||
# Make report: creates a 'report file' with both source and sample run
|
||||
report: $(TARGET).report
|
||||
|
||||
$(TARGET).report: check $(TARGET).cpp
|
||||
more $(TARGET).cpp $(TARGET).out > $@
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile) and the README"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
# the actual rules (this is a simple sample)
|
||||
include ../rules.mk
|
||||
|
|
|
@ -43,3 +43,18 @@ ustring - demonstrates ICU string manipulation functions
|
|||
included with ICU. You can check it out from the CVS command line
|
||||
by using for example, "cvs co icuapps" instead of "cvs co icu",
|
||||
or through WebCVS at http://oss.software.ibm.com/cvs/icu/icuapps/
|
||||
|
||||
==
|
||||
* How do I build the samples?
|
||||
|
||||
- See the Readme in each subdirectory
|
||||
|
||||
To build all samples at once:
|
||||
|
||||
Unix: - build and install (make install) ICU
|
||||
- be sure 'icu-config' is accessible from the PATH
|
||||
- type 'make all-samples' from this directory
|
||||
(other targets: clean-samples, check-samples)
|
||||
|
||||
- legacy and layout are not included in these lists,
|
||||
please see their individual readmes.
|
||||
|
|
|
@ -1,21 +1,30 @@
|
|||
# Copyright (c) 2002 IBM, Inc. and others
|
||||
# sample code rules for a single-target simple sample
|
||||
|
||||
all: $(TARGET)
|
||||
# list of targets that aren't actually created
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
all: $(ALL_SUBDIR) $(RESTARGET) $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@
|
||||
|
||||
# list of targets that aren't actually created
|
||||
.PHONY: all clean distclean check report
|
||||
$(RESTARGET): $(RESFILES)
|
||||
$(PKGDATA) --name $(RESNAME) --mode $(RESMODE) $(PKGDATAOPTS) $(RESLIST)
|
||||
|
||||
res-install: $(RESTARGET)
|
||||
$(PKGDATA) --name $(RESNAME) --mode $(RESMODE) $(PKGDATAOPTS) $(RESLIST) --install $(shell icu-config --libdir)
|
||||
|
||||
# clean out files
|
||||
distclean clean:
|
||||
distclean clean: $(CLEAN_SUBDIR)
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-rm $(OBJECTS) $(TARGET)
|
||||
-rm $(OBJECTS) $(TARGET) $(RESTARGET) $(RESFILES)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
$(INVOKE) ./$(TARGET) | tee $(TARGET).out
|
||||
|
||||
|
||||
$(INVOKE) $(CHECK_VARS) ./$(TARGET) $(CHECK_ARGS) | tee $(TARGET).out
|
||||
|
||||
## resources
|
||||
%.res: %.txt
|
||||
@echo "generating $@"
|
||||
$(GENRB) $(GENRBOPT) $^
|
||||
|
|
|
@ -1,69 +1,22 @@
|
|||
# Copyright (c) 2000 IBM, Inc. and others
|
||||
# Copyright (c) 2000-2002 IBM, Inc. and others
|
||||
# sample code makefile
|
||||
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change the following line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/share/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
#
|
||||
# - configure, build, install ICU (make install)
|
||||
# - make sure "icu-config" (in the ICU installed bin directory) is on
|
||||
# the path
|
||||
# - do 'make' in this directory
|
||||
|
||||
ICU_DEFAULT_PREFIX=~/icu
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_INC=$(ICU_DEFAULT_PREFIX)/lib/icu/Makefile.inc
|
||||
else
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
endif
|
||||
ICUPATH=
|
||||
|
||||
include $(ICU_INC)
|
||||
|
||||
#### definitions
|
||||
# Name of your target
|
||||
TARGET=translit
|
||||
|
||||
# All object files (C or C++)
|
||||
OBJECTS=main.o util.o
|
||||
# You can simply add 'unaccent.o' to the above line for example.
|
||||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
#### rules
|
||||
# Load in standard makefile definitions
|
||||
include ../defs.mk
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
# Can change this to LINK.c if it is a C only program
|
||||
# Can add more libraries here.
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
$(INVOKE) ./$(TARGET) | tee $(TARGET).out
|
||||
|
||||
# Make report: creates a 'report file' with both source and sample run
|
||||
report: $(TARGET).report
|
||||
|
||||
$(TARGET).report: check $(TARGET).cpp
|
||||
more $(TARGET).cpp $(TARGET).out > $@
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile)"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
# the actual rules (this is a simple sample)
|
||||
include ../rules.mk
|
||||
|
|
|
@ -1,41 +1,24 @@
|
|||
# Copyright (c) 2000 IBM, Inc. and others
|
||||
# udata sample code $Revision: 1.3 $
|
||||
|
||||
|
||||
# udata sample code $Revision: 1.4 $
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change ICU_DEFAULT_PREFIX line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/lib/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
#
|
||||
# - change ICU_DEFAULT_PATH line to point to the 'icu' directory
|
||||
# containing source, data, config, etc..
|
||||
# OR
|
||||
# set the variable ICU_PATH to point at that path
|
||||
#
|
||||
# - configure, build, install ICU
|
||||
# - ensure that 'icu-config' is in the PATH (PREFIX/bin/icu-config)
|
||||
# - if ICU is not built relative to this directory,
|
||||
# set the variable ICU_PATH to the 'icu' directory
|
||||
# (i.e. /foo/icu )
|
||||
# - do 'make' in this directory
|
||||
|
||||
ICU_DEFAULT_PREFIX=/home/srl/II
|
||||
ICU_DEFAULT_PATH=$(HOME)/icu
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_INC=$(ICU_DEFAULT_PREFIX)/lib/icu/Makefile.inc
|
||||
else
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
endif
|
||||
# Include ICU standard definitions
|
||||
include ../defs.mk
|
||||
|
||||
# look for the ICU_PATH variable, guess if not there
|
||||
ICU_DEFAULT_PATH=../../..
|
||||
|
||||
ifeq ($(strip $(ICU_PATH)),)
|
||||
ICU_PATH=$(ICU_DEFAULT_PATH)
|
||||
endif
|
||||
|
||||
include $(ICU_INC)
|
||||
|
||||
# Name of your target
|
||||
TARGET1=reader
|
||||
TARGET2=writer
|
||||
|
@ -47,10 +30,9 @@ OBJECTS=$(OBJECTS1) $(OBJECTS2)
|
|||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(TARGET1) $(TARGET2)
|
||||
|
||||
# The following lines are to make sure ICU_PATH is set properly.
|
||||
writer.o: $(ICU_PATH)/source/tools/toolutil/uoptions.h
|
||||
|
||||
$(ICU_PATH)/source/tools/toolutil/uoptions.h:
|
||||
|
@ -62,7 +44,7 @@ $(ICU_PATH)/source/tools/toolutil/uoptions.h:
|
|||
|
||||
# Only the writer needs these, actually.
|
||||
CPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil
|
||||
#LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil -licu-toolutil
|
||||
LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil)
|
||||
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
@ -70,26 +52,18 @@ CPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil
|
|||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET1) $(TARGET2)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
# Can change this to LINK.c if it is a C only program
|
||||
# Can add more libraries here.
|
||||
$(TARGET1): $(OBJECTS1)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
$(TARGET2): $(OBJECTS2)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET1) $(TARGET2)
|
||||
$(INVOKE) ./$(TARGET2) | tee $(TARGET2).out
|
||||
$(INVOKE) ./$(TARGET1) | tee $(TARGET1).out
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile)"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
|
|
|
@ -6,27 +6,19 @@
|
|||
#
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change the following line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/lib/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
# - make sure the script 'icu-config' is executable in your PATH
|
||||
#
|
||||
# - do 'gmake' in this directory
|
||||
# - do 'gmake check' to run the sample.
|
||||
#
|
||||
|
||||
ICU_DEFAULT_PREFIX=/export/andy/icui
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_PREFIX=$(ICU_DEFAULT_PREFIX)
|
||||
endif
|
||||
# Load ICU information
|
||||
include ../defs.mk
|
||||
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
include $(ICU_INC)
|
||||
include fortunedefs.mk
|
||||
|
||||
# Name of your target
|
||||
TARGET=ufortune
|
||||
|
@ -34,51 +26,27 @@ TARGET=ufortune
|
|||
# All object files (C or C++)
|
||||
OBJECTS=ufortune.o
|
||||
|
||||
SUBDIRS = resources
|
||||
# dir containing resources
|
||||
RESDIR=resources
|
||||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
# hook variables to tell rules.mk we want subdirectory processing
|
||||
ALL_SUBDIR= all-$(RESDIR)
|
||||
CLEAN_SUBDIR= clean-$(RESDIR)
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
# Need: ustdio, and to link with ufortune
|
||||
LDFLAGS += $(LDFLAGS_USTDIO) $(RESLDFLAGS)
|
||||
CPPFLAGS += $(RESCPPFLAGS)
|
||||
|
||||
# For ufortune, INVOKE needs current directory on the lib path to pick up
|
||||
# the resources .so. (For Solaris. Not needed for Linux. Others unknown.)
|
||||
UFINVOKE = $(LDLIBRARYPATH_ENVVAR)=$(libdir):.:$$$(LDLIBRARYPATH_ENVVAR)
|
||||
### Include standard rules
|
||||
include ../rules.mk
|
||||
|
||||
all: subdirs $(TARGET)
|
||||
# subdirectory processing
|
||||
all-$(RESDIR):
|
||||
$(MAKE) -C $(RESDIR)
|
||||
|
||||
.PHONY: all clean distclean check report subdirs $(SUBDIRS)
|
||||
|
||||
subdirs: $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
distclean clean: subdirs
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET)
|
||||
-$(RMV) $(DEPS)
|
||||
clean-$(RESDIR):
|
||||
-$(MAKE) -C $(RESDIR) clean
|
||||
|
||||
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.c) -o $@ $(OBJECTS) $(ICULIBS) -L. -lfortune_resources$(ICULIBSUFFIX)
|
||||
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
$(UFINVOKE) ./$(TARGET) | tee $(TARGET).out
|
||||
|
||||
# Make report: creates a 'report file' with both source and sample run
|
||||
report: $(TARGET).report
|
||||
|
||||
$(TARGET).report: check $(TARGET).c
|
||||
more $(TARGET).c $(TARGET).out > $@
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile)"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
install-$(RESDIR):
|
||||
$(MAKE) -C $(RESDIR) install
|
||||
|
|
40
icu4c/source/samples/ufortune/fortunedefs.mk
Normal file
40
icu4c/source/samples/ufortune/fortunedefs.mk
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Copyright (c) 2001-2002 IBM, Inc. and others
|
||||
# common makefile between ufortune and ufortune/resources
|
||||
|
||||
# mode of resource bundle -
|
||||
# you can change this to:
|
||||
# dll - will create a dynamically linked library
|
||||
# (may require 'make install' in resources subdir for
|
||||
# proper library installation)
|
||||
#
|
||||
# static - will statically link data into ufortune
|
||||
#
|
||||
# common - will create fortune_resources.dat in the resources subdir
|
||||
# (must be locatable by ICU_PATH - use 'make check')
|
||||
#
|
||||
# files - will use separate files, such as es.res, fi.res, etc.
|
||||
# (use 'make check')
|
||||
#
|
||||
RESMODE=static
|
||||
|
||||
# Resource shortname
|
||||
RESNAME=fortune_resources
|
||||
|
||||
RESLDFLAGS=
|
||||
# Don't call udata_setAppData unless we are linked with the data
|
||||
RESCPPFLAGS=-DUFORTUNE_NOSETAPPDATA
|
||||
CHECK_VARS= ICU_DATA=$(RESDIR)
|
||||
|
||||
# DLL and static modes are identical here
|
||||
ifeq ($(RESMODE),dll)
|
||||
RESLDFLAGS= -L$(RESDIR) -l$(RESNAME)
|
||||
RESCPPFLAGS=
|
||||
CHECK_VARS=
|
||||
endif
|
||||
|
||||
ifeq ($(RESMODE),static)
|
||||
RESLDFLAGS= -L$(RESDIR) -l$(RESNAME)
|
||||
RESCPPFLAGS=
|
||||
CHECK_VARS=
|
||||
endif
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
# Copyright (c) 2001 IBM, Inc. and others
|
||||
|
||||
# Copyright (c) 2001-2002 IBM, Inc. and others
|
||||
#
|
||||
# File
|
||||
# icu/source/samples/ufortune/resources/Makefile
|
||||
|
@ -25,62 +23,28 @@
|
|||
# files, and genccode emits the data as C source
|
||||
# code that can then be built into a .so
|
||||
#
|
||||
ICU_DEFAULT_PREFIX=/export/andy/icui
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_PREFIX=$(ICU_DEFAULT_PREFIX)
|
||||
endif
|
||||
include ../../defs.mk
|
||||
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
ICUPATH=
|
||||
# No conventional target - this dir is resources only.
|
||||
TARGET=
|
||||
CLEANFILES += *.mak *.[co] *.lst *.a *.$(SO) $(RESFILES) *.ao README*resources.txt
|
||||
|
||||
include $(ICU_INC)
|
||||
include ../fortunedefs.mk
|
||||
|
||||
# Name of your target
|
||||
TARGET=libfortune_resources.$(SO)
|
||||
|
||||
# Add implicit rule for .txt to .res
|
||||
# ICU resources are compiled into .res files by the genrb tool
|
||||
#
|
||||
%.res: %.txt
|
||||
$(INVOKE) $(sbindir)/genrb -d . $<
|
||||
# target file for resource bundle - this must be set, or 'make all' won't
|
||||
# build any resources.
|
||||
RESTARGET=lib$(RESNAME).$(SO)
|
||||
|
||||
# Resource files. Add new ones for additional locales here.
|
||||
# keep in sync with the file RESLIST
|
||||
RESFILES=root.res es.res
|
||||
|
||||
# list of resource bundles - keep in sync with RESFILES
|
||||
RESLIST=res-file-list.txt
|
||||
|
||||
# All object files (C or C++)
|
||||
OBJECTS=
|
||||
## Include standard rules
|
||||
include ../../rules.mk
|
||||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET) $(RESFILES)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
$(TARGET): $(RESFILES)
|
||||
$(INVOKE) $(sbindir)/pkgdata --name fortune_resources -v -O $(ICU_INC) --mode dll -d . res-file-list.txt
|
||||
cp $(TARGET) ..
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET)
|
||||
|
||||
# Make report: creates a 'report file' with both source and sample run
|
||||
report:
|
||||
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile)"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
# -include $(DEPS)
|
||||
endif
|
||||
# for installing the library
|
||||
install: res-install
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
/* set conversions. */
|
||||
#include "unicode/ustring.h"
|
||||
|
||||
#ifndef UFORTUNE_NOSETAPPDATA
|
||||
/*
|
||||
* Resource Data Reference. The data is packaged as a dll (or .so or
|
||||
* whatever, depending on the platform) that exports a data
|
||||
|
@ -41,6 +42,8 @@
|
|||
* be able to fetch resources from the data.
|
||||
*/
|
||||
extern const void U_IMPORT *fortune_resources_dat;
|
||||
#endif
|
||||
|
||||
void u_write(const UChar *what, int len);
|
||||
|
||||
|
||||
|
@ -106,6 +109,7 @@ int main(int argc, char **argv)
|
|||
u_fprintf(u_stdout, "%s: checking output via ustdio.\n", programName);
|
||||
}
|
||||
|
||||
#ifndef UFORTUNE_NOSETAPPDATA
|
||||
/* Tell ICU where our resource data is located in memory.
|
||||
* The data lives in the Fortune_Resources dll, and we just
|
||||
* pass the address of an exported symbol from that library
|
||||
|
@ -116,6 +120,7 @@ int main(int argc, char **argv)
|
|||
fprintf(stderr, "%s: ures_open failed with error \"%s\"\n", programName, u_errorName(err));
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Open our resources.
|
||||
*/
|
||||
|
|
|
@ -1,35 +1,16 @@
|
|||
# Copyright (c) 2000 IBM, Inc. and others
|
||||
# conversion sample code $Revision: 1.5 $
|
||||
|
||||
|
||||
# conversion sample code $Revision: 1.6 $
|
||||
# Usage:
|
||||
# - configure and build ICU [see the docs] .. use "--prefix=" something
|
||||
# (I used --prefix=/home/srl/III )
|
||||
#
|
||||
# - do 'make install' of icu
|
||||
#
|
||||
# - change ICU_DEFAULT_PREFIX line to point to the $(prefix) that
|
||||
# was used (will look for $(prefix)/lib/icu/Makefile.inc )
|
||||
# OR
|
||||
# set the variable ICU_PREFIX to point at $(prefix)
|
||||
#
|
||||
# - change ICU_DEFAULT_PATH line to point to the 'icu' directory
|
||||
# containing source, data, config, etc..
|
||||
# OR
|
||||
# set the variable ICU_PATH to point at that path
|
||||
#
|
||||
# - configure, build, install ICU
|
||||
# - ensure that 'icu-config' is in the PATH (PREFIX/bin/icu-config)
|
||||
# - if ICU is not built relative to this directory,
|
||||
# set the variable ICU_PATH to the 'icu' directory
|
||||
# (i.e. /foo/icu )
|
||||
# - do 'make' in this directory
|
||||
|
||||
ICU_DEFAULT_PREFIX=ICU_PREFIX
|
||||
ICU_DEFAULT_PATH=../../..
|
||||
include ../defs.mk
|
||||
|
||||
ifeq ($(strip $(ICU_PREFIX)),)
|
||||
ICU_INC=$(ICU_DEFAULT_PREFIX)/lib/icu/Makefile.inc
|
||||
GENRB = $(ICU_DEFAULT_PREFIX)/sbin/genrb
|
||||
else
|
||||
ICU_INC=$(ICU_PREFIX)/lib/icu/Makefile.inc
|
||||
GENRB = $(ICU_PREFIX)/sbin/genrb
|
||||
endif
|
||||
ICU_DEFAULT_PATH=../../..
|
||||
|
||||
ifeq ($(strip $(ICU_PATH)),)
|
||||
ICU_PATH=$(ICU_DEFAULT_PATH)
|
||||
|
@ -37,8 +18,6 @@ endif
|
|||
|
||||
GENRBOPT = -s. -d.
|
||||
|
||||
include $(ICU_INC)
|
||||
|
||||
# Name of your target
|
||||
TARGET=uresb
|
||||
RESOURCES = root.res en.res sr.res
|
||||
|
@ -48,9 +27,7 @@ OBJECTS=uresb.o
|
|||
|
||||
CLEANFILES=*~ $(TARGET).out
|
||||
|
||||
DEPS=$(OBJECTS:.o=.d)
|
||||
|
||||
all: $(GENRB) $(RESOURCES) $(TARGET)
|
||||
all: $(RESOURCES) $(TARGET)
|
||||
|
||||
uresb.o: $(ICU_PATH)/source/tools/toolutil/uoptions.h
|
||||
|
||||
|
@ -60,39 +37,29 @@ $(ICU_PATH)/source/tools/toolutil/uoptions.h:
|
|||
@false
|
||||
|
||||
CPPFLAGS += -I$(ICU_PATH)/source/tools/toolutil
|
||||
LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil -licutoolutil -lustdio
|
||||
|
||||
$(GENRB):
|
||||
@echo "Please read the directions at the top of this file (Makefile)"
|
||||
@echo "Can't open $@ - check ICU_PATH"
|
||||
@false
|
||||
LDFLAGS += -L$(ICU_PATH)/source/tools/toolutil $(shell icu-config --ldflags-toolutil --ldflags-ustdio)
|
||||
|
||||
.PHONY: all clean distclean check report
|
||||
|
||||
distclean clean:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(RMV) $(OBJECTS) $(TARGET)
|
||||
-$(RMV) $(DEPS)
|
||||
|
||||
|
||||
## resources
|
||||
root.res : root.txt
|
||||
%.res: %.txt
|
||||
@echo "generating $@"
|
||||
$(GENRB) $(GENRBOPT) $?
|
||||
|
||||
en.res : en.txt
|
||||
@echo "generating $@"
|
||||
$(GENRB) $(GENRBOPT) $?
|
||||
$(GENRB) $(GENRBOPT) $^
|
||||
|
||||
## Special for a special codepage
|
||||
sr.res : sr.txt
|
||||
@echo "generating $@"
|
||||
$(GENRB) $(GENRBOPT) -e cp1251 $?
|
||||
|
||||
|
||||
|
||||
# Can change this to LINK.c if it is a C only program
|
||||
# Can add more libraries here.
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.cc) -o $@ $^ $(ICULIBS)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
# Make check: simply runs the sample, logged to a file
|
||||
check: $(TARGET) $(RESOURCES)
|
||||
|
@ -104,14 +71,6 @@ report: $(TARGET).report
|
|||
$(TARGET).report: check $(TARGET).cpp
|
||||
more $(TARGET).cpp $(TARGET).out > $@
|
||||
|
||||
$(ICU_INC):
|
||||
@echo "Please read the directions at the top of this file (Makefile)"
|
||||
@echo "Can't open $(ICU_INC)"
|
||||
@false
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue