aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-11-26 08:20:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-11-26 08:20:55 +0200
commit6b482c6d405f1468eaac3059b3353eb0805cca9c (patch)
tree39501e0babc1e143270c3d3dc57f5f17dd7b0b4c
parentce34bbfa556248164337bad533d411c7b84ef5da (diff)
Use switch in buildfile
-rw-r--r--libbutl/buildfile48
1 files changed, 25 insertions, 23 deletions
diff --git a/libbutl/buildfile b/libbutl/buildfile
index e6841ab..1a6b599 100644
--- a/libbutl/buildfile
+++ b/libbutl/buildfile
@@ -22,12 +22,7 @@ lib{butl}: {hxx ixx txx cxx}{** -uuid-* +uuid-io \
tclass = $cxx.target.class
tsys = $cxx.target.system
-linux = ($tclass == 'linux')
-macos = ($tclass == 'macos')
windows = ($tclass == 'windows')
-freebsd = ($tsys == 'freebsd')
-
-mingw = ($tsys == 'mingw32')
# Exclude these from compilation on non-Windows targets.
#
@@ -41,19 +36,33 @@ lib{butl}: file{*.c *.h}
# Platform-specific UUID implementations.
#
-lib{butl}: cxx{uuid-linux}: include = $linux
-lib{butl}: cxx{uuid-macos}: include = $macos
+lib{butl}: cxx{uuid-linux}: include = ($tclass == 'linux')
+lib{butl}: cxx{uuid-macos}: include = ($tclass == 'macos')
lib{butl}: cxx{uuid-windows}: include = $windows
-lib{butl}: cxx{uuid-freebsd}: include = $freebsd
+lib{butl}: cxx{uuid-freebsd}: include = ($tsys == 'freebsd')
+
+# Additional system libraries.
+#
+switch $tclass, $tsys
+{
+ case 'linux'
+ cxx.libs += -ldl
+
+ case 'macos'
+ cxx.libs += -framework CoreFoundation
+
+ case 'windows', 'mingw32'
+ cxx.libs += -lrpcrt4 -limagehlp
+
+ case 'windows'
+ cxx.libs += rpcrt4.lib imagehlp.lib
-if $linux
- cxx.libs += -ldl
-elif $macos
- cxx.libs += -framework CoreFoundation
-elif $windows
- cxx.libs += ($mingw ? -lrpcrt4 : rpcrt4.lib)
-elif $freebsd
- cxx.libs += -lexecinfo
+ case 'bsd', 'freebsd'
+ cxx.libs += -lexecinfo
+}
+
+if! $windows
+ cxx.libs += -lpthread
# Include the generated version header into the distribution (so that we don't
# pick up an installed one) and don't remove it when cleaning in src (so that
@@ -73,13 +82,6 @@ cxx.poptions =+ "-I$out_root" "-I$src_root"
obja{*} bmia{*}: cxx.poptions += -DLIBBUTL_STATIC_BUILD
objs{*} bmis{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD
-# Additional system libraries.
-#
-if $windows
- cxx.libs += ($mingw ? -limagehlp : imagehlp.lib)
-else
- cxx.libs += -lpthread
-
# Export options.
#
lib{butl}: cxx.export.poptions = "-I$out_root" "-I$src_root"