summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-11-29 11:21:06 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-11-29 22:05:15 +0300
commit2249beae2c6ef584cd9c05d7876a39e2b17494b6 (patch)
tree5a0b9c2cb4eb1ee3e2699573960f41877c56cca5
parentdbbe77bc50fdf58f69bd6dadc130c129b481f79b (diff)
Use switch in buildfileswitch
-rw-r--r--libcmark-gfm-extensions/libcmark-gfm-extensions/buildfile42
-rw-r--r--libcmark-gfm/libcmark-gfm/buildfile8
2 files changed, 22 insertions, 28 deletions
diff --git a/libcmark-gfm-extensions/libcmark-gfm-extensions/buildfile b/libcmark-gfm-extensions/libcmark-gfm-extensions/buildfile
index 5229fd9..6f57397 100644
--- a/libcmark-gfm-extensions/libcmark-gfm-extensions/buildfile
+++ b/libcmark-gfm-extensions/libcmark-gfm-extensions/buildfile
@@ -6,41 +6,39 @@ import int_libs = libcmark-gfm%lib{cmark-gfm}
lib{cmark-gfm-extensions}: {h c}{**} $int_libs
-windows = ($c.target.class == 'windows')
-
-gcc = ($c.class == 'gcc')
-msvc = ($c.class == 'msvc')
-
# Build options.
#
obja{*}: c.poptions += -DCMARK_GFM_EXTENSIONS_STATIC_BUILD
objs{*}: c.poptions += -DCMARK_GFM_EXTENSIONS_SHARED_BUILD
-if! $windows
+if ($c.target.class != 'windows')
c.coptions += -fvisibility=hidden
else
c.poptions += -DWIN32 -D_WINDOWS
c.poptions =+ "-I$src_base" "-I$src_base/extensions"
-if $msvc
-{
- # Disable warnings that pop up with /W3.
- #
- c.coptions += /wd4311
-}
-elif $gcc
+switch $c.class
{
- c.coptions += -pedantic
+ case 'gcc'
+ {
+ c.coptions += -pedantic
- # Disable warnings that pop up with -Wextra. Upstream doesn't seem to care
- # about these and it is not easy to disable specific warnings in a way that
- # works across compilers/version (some -Wno-* options are only recognized in
- # newer versions). There are still some warnings left that appear for
- # certain platforms/compilers. We pass them through but disable treating
- # them as errors.
- #
- c.coptions += -Wno-extra -Wno-error
+ # Disable warnings that pop up with -Wextra. Upstream doesn't seem to care
+ # about these and it is not easy to disable specific warnings in a way
+ # that works across compilers/version (some -Wno-* options are only
+ # recognized in newer versions). There are still some warnings left that
+ # appear for certain platforms/compilers. We pass them through but disable
+ # treating them as errors.
+ #
+ c.coptions += -Wno-extra -Wno-error
+ }
+ case 'msvc'
+ {
+ # Disable warnings that pop up with /W3.
+ #
+ c.coptions += /wd4311
+ }
}
# Export options.
diff --git a/libcmark-gfm/libcmark-gfm/buildfile b/libcmark-gfm/libcmark-gfm/buildfile
index 7bd499a..ec95650 100644
--- a/libcmark-gfm/libcmark-gfm/buildfile
+++ b/libcmark-gfm/libcmark-gfm/buildfile
@@ -9,10 +9,6 @@ lib{cmark-gfm}: {h }{* -version} \
{h }{ version} \
src/{h inc c}{* -main}
-windows = ($c.target.class == 'windows')
-
-gcc = ($c.class == 'gcc')
-
# No need to include the generated version header into the distribution since
# it is installed under a different name and so the correct one will always
# be picked up.
@@ -32,7 +28,7 @@ h{version}: src/in{cmark-gfm_version} $src_root/manifest
obja{*}: c.poptions += -DCMARK_GFM_STATIC_BUILD
objs{*}: c.poptions += -DCMARK_GFM_SHARED_BUILD
-if! $windows
+if ($c.target.class != 'windows')
c.coptions += -fvisibility=hidden
else
c.poptions += -DWIN32 -D_WINDOWS
@@ -42,7 +38,7 @@ else
#
c.poptions =+ "-I$out_root" "-I$src_root" "-I$src_base" "-I$src_base/src"
-if $gcc
+if ($c.class == 'gcc')
{
c.coptions += -pedantic