[Omake] P.S.

Aleksey Nogin nogin at cs.caltech.edu
Sat Jun 10 11:49:28 PDT 2006


On 10.06.2006 07:02, Benjamin Pierce wrote:

> For completeness, here is the definition of COMMON_SOURCES...
[...]
> UBASE_LIB_SOURCES = safelist.ml uprintf.ml util.ml uarg.ml prefs.ml  
> trace.ml
[...]
> COMMON_SOURCES = \
>   $(foreach $(file), \
>     $(addprefix $(TOOLSDIR)/, $(SRC2FCL_SOURCES)) \
>     $(addprefix $(SRCDIR)/ubase/, $(UBASE_LIB_SOURCES)) \
>     $(addprefix $(SRCDIR)/, $(BASE_SOURCES)) \
>     $(addprefix $(LENSESDIR)/, $(NATIVE_LENS_SOURCES)) \
>     $(addprefix $(SRCDIR)/, $(TOPLEVEL_SOURCES)))

Minor stylistic comments:

In this case it probably does not matter, but normally we would make all 
these variables be arrays, using either the

UBASE_LIB_SOURCES[] = safelist.ml uprintf.ml ...

syntax or even

UBASE_LIB_SOURCES[] =
    safelist.ml
    uprintf.ml
    ...

The second format, although occupies more screen space, has two 
potential advantages:
  - In a versioning system, "svn annotate"/"cvs annotate"/etc would tell 
you when a file was added to the list.
  - It makes it possible to have file names with white space in them:

UBASE_LIB_SOURCES[] =
    safelist.ml
    lib with a space.ml
    ...

Also, most of the omake's functions would map sequences/arrays into 
arrays, so  you should be able to simply use $(file ...) in place of 
$(foreach $(file), ...).

For example, in osh:

% cd /tmp/
% foo=$(file bar baz)
- : <array
        /tmp/bar : File
        /tmp/baz : File>
        : Array

-- 
Aleksey Nogin

Home Page: http://nogin.org/
E-Mail: nogin at cs.caltech.edu (office), aleksey at nogin.org (personal)
Office: Moore 04, tel: (626) 395-2200


More information about the Omake mailing list