Skip to content

Commit

Permalink
export of omake
Browse files Browse the repository at this point in the history
  • Loading branch information
camlspotter committed Jun 26, 2017
1 parent c19270c commit 7096e5e
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
7 changes: 7 additions & 0 deletions omake/OMakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export1(foo) =
eprintln(foo=$(foo))
export # argument is exported to the outside!!!

export1(a)
eprintln(foo=$(foo))

45 changes: 45 additions & 0 deletions omake/OMakeroot
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
########################################################################
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this file, to deal in the File without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the File, and to permit persons to whom the
# File is furnished to do so, subject to the following condition:
#
# THE FILE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE FILE OR
# THE USE OR OTHER DEALINGS IN THE FILE.

########################################################################
# The standard OMakeroot file.
# You will not normally need to modify this file.
# By default, your changes should be placed in the
# OMakefile in this directory.
#
# If you decide to modify this file, note that it uses exactly
# the same syntax as the OMakefile.
#

#
# Include the standard installed configuration files.
# Any of these can be deleted if you are not using them,
# but you probably want to keep the Common file.
#
open build/C
open build/OCaml
open build/LaTeX

#
# The command-line variables are defined *after* the
# standard configuration has been loaded.
#
DefineCommandVars()

#
# Include the OMakefile in this directory.
#
.SUBDIRS: .
31 changes: 31 additions & 0 deletions omake_points.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,34 @@ hello.c:
eprintln($(FP)) # 1 !!!
echo "hello" > hello.c
```

# 引数なしの `export`

引数なしの `export` が外に export する変数やルールをちゃんと理解する事が重要

* 全ての動的スコープの変数の値
* カレントディレクトリ
* Unix環境変数
* 現在の implicit rule や implicit dependencies
* 現在の "phony" ターゲット宣言

特に関数引数の名前が外に漏れ出るのが非常に困る。これが理由で `omake` 使えないと言われても仕方がない:

```
export1(foo) =
eprintln(foo=$(foo)) # foo=a
export # argument is exported to the outside!!!
export1(a)
eprintln(foo=$(foo)) # foo=a !!!
```

# 引数ありの `export`

引数がある `export` はその引数を評価後、その引数によって

* 値が空なら引数無し `export` と同じ
* `$(export 変数..)` で作られた環境の場合、その環境
* `.RULE`: implicit rules and implicit dependencies.
* `.PHONY`: the set of “phony” target declarations.
* その他の文字列は変数名として扱いその変数を export する

0 comments on commit 7096e5e

Please sign in to comment.