@@ -390,17 +390,21 @@ allow-newer-deps:
390
390
391
391
Default : ` locals`
392
392
393
- Which packages do ghc-options on the command line get applied to? Before Stack
394
- 0.1.6, the default value was `targets`
393
+ Related command line:
394
+ [`stack build --ghc-options`](build_command.md#ghc-options-option) option
395
395
396
- ~~~yaml
397
- apply-ghc-options : locals # all local packages
398
- # apply-ghc-options: targets # all local packages that are targets
399
- # apply-ghc-options: everything # applied even to snapshot and extra-deps
400
- ~~~
396
+ Determines to which packages any GHC command line options specified on the
397
+ command line are applied. Possible values are : ` everything` (all packages, local
398
+ or otherwise), `locals` (all local packages, targets or otherwise), and
399
+ ` targets` (all local packages that are targets).
400
+
401
+ !!! note
402
+
403
+ The use of `everything` can break invariants about your snapshot database.
404
+
405
+ !!! note
401
406
402
- Note that ` everything ` is a slightly dangerous value, as it can break invariants
403
- about your snapshot database.
407
+ Before Stack 0.1.6.0, the default value was `targets`.
404
408
405
409
# ## arch
406
410
@@ -760,17 +764,30 @@ arguments include `standard`, `gmp4`, `nopie`, `tinfo6`, `tinfo6-nopie`,
760
764
761
765
[:octicons-tag-24 : 0.1.4.0](https://github.com/commercialhaskell/stack/releases/tag/v0.1.4.0)
762
766
763
- Allows specifying per-package and global GHC options :
767
+ Default : ` {}`
768
+
769
+ Related command line (takes precedence) :
770
+ [`stack build --ghc-options`](build_command.md#ghc-options-option) option
771
+
772
+ ` ghc-options` can specify GHC command line options for a named package, all
773
+ local packages that are targets (using the `$targets` key), all local packages
774
+ (targets or otherwise) (using the `$locals` key), or all packages (local or
775
+ otherwise) (using the `$everything` key).
764
776
765
777
~~~yaml
766
778
ghc-options :
767
- # All packages
768
- " $locals " : -Wall
769
- " $targets " : -Werror
770
- " $everything " : -O2
771
- some-package : -DSOME_CPP_FLAG
779
+ " $everything " : -O2
780
+ " $locals " : -Wall
781
+ " $targets " : -Werror
782
+ some-package : -DSOME_CPP_FLAG
772
783
~~~
773
784
785
+ GHC's command line options are _order-dependent_ and evaluated from left to
786
+ right. Later options can override earlier options. Stack applies options (as
787
+ applicable) in the order of `$everything`, `$locals`, `$targets`, and then those
788
+ for the named package. Any existing GHC command line options of a package are
789
+ applied after those specified in Stack's YAML configuration.
790
+
774
791
Since Stack 1.6.0, setting a GHC options for a specific package will
775
792
automatically promote it to a local package (much like setting a custom package
776
793
flag). However, setting options via `$everything` on all flags will not do so
@@ -779,17 +796,10 @@ flag). However, setting options via `$everything` on all flags will not do so
779
796
for reasoning). This can lead to unpredictable behavior by affecting your
780
797
snapshot packages.
781
798
782
- The behavior of the `$locals`, `$targets`, and `$everything` special keys
783
- mirrors the behavior for the
784
- [`apply-ghc-options` setting](#apply-ghc-options), which affects command line
785
- parameters.
786
-
787
799
!!! note
788
800
789
- Prior to Stack 1.6.0, the `$locals`, `$targets`, and `$everything` keys
790
- were not supported. Instead, you could use `"*"` for the behavior
791
- represented now by `$everything`. It is highly recommended to switch to the
792
- new, more expressive, keys.
801
+ Before Stack 1.6.0, the key `*` (now deprecated) had the same function as
802
+ the key `$everything`.
793
803
794
804
# ## ghc-variant
795
805
0 commit comments