History

Add support for -dumpmachine option.

Better compatibility with some build systems assuming gcc.

Reimar Döffinger committed 3 years ago

Commit 32ac2361 parent 7a530291 file · +36 −0Browse files

Unified · Split

libtcc.c+36−0
@@ -1582,6 +1582,7 @@ enum { · 1581 unmodified lines
15821582 TCC_OPTION_ba,
15831583 TCC_OPTION_g,
15841584 TCC_OPTION_c,
1585+ TCC_OPTION_dumpmachine,
15851586 TCC_OPTION_dumpversion,
15861587 TCC_OPTION_d,
15871588 TCC_OPTION_static,
@@ -1659,6 +1660,7 @@ static const TCCOption tcc_options[] = { · 71 unmodified lines
16591660 #ifdef TCC_TARGET_MACHO
16601661 { "dynamiclib", TCC_OPTION_dynamiclib, 0 },
16611662 #endif
1663+ { "dumpmachine", TCC_OPTION_dumpmachine, 0},
16621664 { "dumpversion", TCC_OPTION_dumpversion, 0},
16631665 { "d", TCC_OPTION_d, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
16641666 { "static", TCC_OPTION_static, 0 },
@@ -2138,6 +2140,40 @@ dorun: · 473 unmodified lines
21382140 case TCC_OPTION_MP:
21392141 s->gen_phony_deps = 1;
21402142 break;
2143+ case TCC_OPTION_dumpmachine:
2144+ /* this is a best guess, please refine as necessary */
2145+ printf("%s",
2146+#ifdef TCC_TARGET_I386
2147+ "i386-pc"
2148+#elif defined TCC_TARGET_X86_64
2149+ "x86_64-pc"
2150+#elif defined TCC_TARGET_C67
2151+ "c67"
2152+#elif defined TCC_TARGET_ARM
2153+ "arm"
2154+#elif defined TCC_TARGET_ARM64
2155+ "aarch64"
2156+#elif defined TCC_TARGET_RISCV64
2157+ "riscv64"
2158+#endif
2159+ "-"
2160+#ifdef TCC_TARGET_PE
2161+ "mingw32"
2162+#elif defined(TCC_TARGET_MACHO)
2163+ "apple-darwin"
2164+#elif TARGETOS_FreeBSD || TARGETOS_FreeBSD_kernel
2165+ "freebsd"
2166+#elif TARGETOS_OpenBSD
2167+ "openbsd"
2168+#elif TARGETOS_NetBSD
2169+ "netbsd"
2170+#else
2171+ "linux-gnu"
2172+#endif
2173+ "\n"
2174+ );
2175+ exit(0);
2176+ break;
21412177 case TCC_OPTION_dumpversion:
21422178 printf ("%s\n", TCC_VERSION);
21432179 exit(0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t