aboutsummaryrefslogtreecommitdiff
path: root/targ.c
diff options
context:
space:
mode:
Diffstat (limited to 'targ.c')
-rw-r--r--targ.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/targ.c b/targ.c
new file mode 100644
index 0000000..a3fd2f0
--- /dev/null
+++ b/targ.c
@@ -0,0 +1,34 @@
+#include <stdint.h>
+#include <string.h>
+#include "util.h"
+#include "cc.h"
+
+struct target *targ;
+
+static struct target alltargs[] = {
+ {
+ .name = "x86_64",
+ },
+ {
+ .name = "aarch64",
+ },
+};
+
+void
+targinit(const char *name)
+{
+ size_t i;
+
+ if (!name) {
+ /* TODO: provide a way to set this default */
+ targ = &alltargs[0];
+ return;
+ }
+ for (i = 0; i < LEN(alltargs); ++i) {
+ if (strcmp(alltargs[i].name, name) == 0) {
+ targ = &alltargs[i];
+ return;
+ }
+ }
+ fatal("unknown target '%s'", name);
+}