| 1 | # Copyright (c) 2005 Vladimir Prus. |
|---|
| 2 | # |
|---|
| 3 | # Use, modification and distribution is subject to the Boost Software |
|---|
| 4 | # License Version 1.0. (See accompanying file LICENSE_1_0.txt or |
|---|
| 5 | # http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 6 | |
|---|
| 7 | import generators ; |
|---|
| 8 | import type ; |
|---|
| 9 | import feature ; |
|---|
| 10 | import project ; |
|---|
| 11 | import targets ; |
|---|
| 12 | import toolset ; |
|---|
| 13 | import "class" : new ; |
|---|
| 14 | |
|---|
| 15 | feature.feature action : : free ; |
|---|
| 16 | type.register NOTFILE_MAIN ; |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | class notfile-generator : generator |
|---|
| 21 | { |
|---|
| 22 | rule __init__ ( * : * ) |
|---|
| 23 | { |
|---|
| 24 | generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | rule run ( project name ? : property-set : sources * : multiple ? ) |
|---|
| 28 | { |
|---|
| 29 | local action ; |
|---|
| 30 | local action-name = [ $(property-set).get <action> ] ; |
|---|
| 31 | |
|---|
| 32 | local m = [ MATCH ^@(.*) : $(action-name) ] ; |
|---|
| 33 | |
|---|
| 34 | if $(m) |
|---|
| 35 | { |
|---|
| 36 | action = [ new action $(sources) : $(m[1]) |
|---|
| 37 | : $(property-set) ] ; |
|---|
| 38 | } |
|---|
| 39 | else |
|---|
| 40 | { |
|---|
| 41 | action = [ new action $(sources) : notfile.run |
|---|
| 42 | : $(property-set) ] ; |
|---|
| 43 | } |
|---|
| 44 | return [ new notfile-target $(name) : $(project) : $(action) ] ; |
|---|
| 45 | } |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | generators.register [ new notfile-generator notfile.main : : NOTFILE_MAIN ] ; |
|---|
| 49 | |
|---|
| 50 | toolset.flags notfile.run ACTION : <action> ; |
|---|
| 51 | actions run |
|---|
| 52 | { |
|---|
| 53 | $(ACTION) |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | rule notfile ( target-name : action + : sources * : requirements * : default-build * ) |
|---|
| 58 | { |
|---|
| 59 | local project = [ project.current ] ; |
|---|
| 60 | |
|---|
| 61 | requirements += <action>$(action) ; |
|---|
| 62 | |
|---|
| 63 | targets.main-target-alternative |
|---|
| 64 | [ new typed-target $(target-name) : $(project) : NOTFILE_MAIN |
|---|
| 65 | : [ targets.main-target-sources $(sources) : $(target-name) ] |
|---|
| 66 | : [ targets.main-target-requirements $(requirements) : $(project) ] |
|---|
| 67 | : [ targets.main-target-default-build $(default-build) : $(project) ] |
|---|
| 68 | ] ; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | IMPORT $(__name__) : notfile : : notfile ; |
|---|
| 72 | |
|---|
| 73 | |
|---|