mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
* refactor: Move code out of Macros.carp into other files * fix: Move back some macros needed in --no-core mode * refactor: Remove weird 'evaluate' macros * fix: Put back more macros * fix: Remove transitive loading of Macros.carp * refactor: Remove ArrayMacros.carp and put 'for' at top of Array.carp instead * refactor: More splitting up * refactor: Move back save-docs * fix: Moved back some stuff Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
65 lines
2.0 KiB
Plaintext
65 lines
2.0 KiB
Plaintext
(doc native-triple "triple describing the native platform.")
|
|
(defdynamic native-triple [(host-arch) (host-os) "unknown"])
|
|
|
|
(doc target-triple "triple describing the target platform.")
|
|
(defndynamic target-triple []
|
|
(let [t (Project.get-config "target")]
|
|
(case t
|
|
"native" native-triple
|
|
(Dynamic.String.split-on "-" t))))
|
|
|
|
(doc target-arch "target architecture.")
|
|
(defdynamic target-arch (car (target-triple)))
|
|
|
|
(doc target-os "target operating system.")
|
|
(defdynamic target-os (cadr (target-triple)))
|
|
|
|
(doc target-abi "target ABI.")
|
|
(defdynamic target-abi (caddr (target-triple)))
|
|
|
|
(doc target-os? "are we targeting a certain OS?")
|
|
(defndynamic target-os? [t]
|
|
(= target-os t))
|
|
|
|
(doc windows-target? "are we targeting Windows?")
|
|
(defdynamic windows-target?
|
|
(if (target-os? "windows")
|
|
true
|
|
(target-os? "mingw32")))
|
|
|
|
(doc linux-target? "are we targeting Linux?")
|
|
(defdynamic linux-target? (target-os? "linux"))
|
|
|
|
(doc mac-target? "are we targeting Mac?")
|
|
(defdynamic mac-target? (target-os? "darwin"))
|
|
|
|
(doc freebsd-target? "are we targeting FreeBSD?")
|
|
(defdynamic freebsd-target? (target-os? "freebsd"))
|
|
|
|
(doc posix-target? "are we targeting a POSIX platform?")
|
|
(defdynamic posix-target? (= false windows-target?))
|
|
|
|
(doc target-only "conditionally compile forms when b is true.")
|
|
(defndynamic target-only [b forms]
|
|
(when b
|
|
(eval (cons 'do forms))))
|
|
|
|
(doc mac-only "compile forms only on Mac.")
|
|
(defmacro mac-only [:rest forms]
|
|
(target-only mac-target? forms))
|
|
|
|
(doc linux-only "compile forms only on Linux.")
|
|
(defmacro linux-only [:rest forms]
|
|
(target-only linux-target? forms))
|
|
|
|
(doc freebsd-only "compile forms only on FreeBSD.")
|
|
(defmacro freebsd-only [:rest forms]
|
|
(target-only freebsd-target? forms))
|
|
|
|
(doc windows-only "compile forms only on Windows.")
|
|
(defmacro windows-only [:rest forms]
|
|
(target-only windows-target? forms))
|
|
|
|
(doc posix-only "compile forms only on POSIX targets.")
|
|
(defmacro posix-only [:rest forms]
|
|
(target-only posix-target? forms)) |