ICU-1852 cleaning up samples

X-SVN-Rev: 8455
This commit is contained in:
Steven R. Loomis 2002-04-13 14:18:10 +00:00
parent 8543ddb66b
commit 1a45d55cbc
2 changed files with 130 additions and 0 deletions

View File

@ -0,0 +1,68 @@
# Copyright (c) 2000 IBM, Inc. and others
# 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)
#
# - 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=numfmt
# All object files (C or C++)
OBJECTS=main.o util.o capi.o
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)
-$(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

View File

@ -0,0 +1,62 @@
numfmt: a sample program which displays the calendar.
This sample demonstrates
Formatting a calendar
Outputting text in the default codepage to the console
Files:
main.cpp Main source file in C++
capi.c C interface.
util.cpp formatted output convenience implementation
util.h formatted output convenience header
numfmt.dsw Windows MSVC workspace. Double-click this to get started.
numfmt.dsp Windows MSVC project file
To Build ufortune on Windows
1. Install and build ICU
2. In MSVC, open the workspace file icu\samples\numfmt\numfmt.dsw
3. Choose a Debug or Release build.
4. Build.
To Run on Windows
1. Start a command shell window
2. Add ICU's bin directory to the path, e.g.
set PATH=c:\icu\bin;%PATH%
(Use the path to where ever ICU is on your system.)
3. cd into the ufortune directory, e.g.
cd c:\icu\source\samples\numfmt\debug
4. Run it
numfmt
To Build on Unixes
1. Build ICU. numfmt is built automatically by default unless samples are turned off.
Specify an ICU install directory when running configure,
using the --prefix option. The steps to build ICU will look something
like this:
cd <icu directory>/source
runConfigureICU <platform-name> --prefix <icu install directory> [other options]
gmake all
2. Install ICU,
gmake install
3. Compile
cd <icu directory>/source/samples/numfmt
gmake ICU_PREFIX=<icu install directory)
To Run on Unixes
cd <icu directory>/source/samples/numfmt
gmake ICU_PREFIX=<icu install directory> check
-or-
export LD_LIBRARY_PATH=<icu install directory>/lib:.:$LD_LIBRARY_PATH
numfmt
Note: The name of the LD_LIBRARY_PATH variable is different on some systems.
If in doubt, run the sample using "gmake check", and note the name of
the variable that is used there. LD_LIBRARY_PATH is the correct name
for Linux and Solaris.