mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
macos: more adjustments for OSX systems
* instead of /usr/include use the current SDK path as system include directory (/usr/include is empty with current tools) (this also removes the need to add these paths in individual Makefiles) * define _DARWIN_C_SOURCE in tcc.h to get the full set of decls from system headers (e.g. vsnprintf), similar to _GNU_SOURCE (and don't define _ANSI_SOURCE in the main Makefile anymore) * tests/tests2/Makefile: remove the -w flag, it's added when necessary in the rules generating the .expect files
This commit is contained in:
parent
f18f865159
commit
4eff2b5f6a
3
Makefile
3
Makefile
@ -58,9 +58,6 @@ TCCFLAGS-unx = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
|
|||||||
TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP)
|
TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP)
|
||||||
TCCFLAGS = $(TCCFLAGS$(CFGWIN))
|
TCCFLAGS = $(TCCFLAGS$(CFGWIN))
|
||||||
TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)
|
TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)
|
||||||
ifdef CONFIG_OSX
|
|
||||||
TCCFLAGS += -D_ANSI_SOURCE
|
|
||||||
endif
|
|
||||||
|
|
||||||
# cross compiler targets to build
|
# cross compiler targets to build
|
||||||
TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
|
TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
|
||||||
|
4
configure
vendored
4
configure
vendored
@ -35,6 +35,7 @@ mingw32="no"
|
|||||||
LIBSUF=".a"
|
LIBSUF=".a"
|
||||||
EXESUF=""
|
EXESUF=""
|
||||||
DLLSUF=".so"
|
DLLSUF=".so"
|
||||||
|
tcc_usrinclude=""
|
||||||
tcc_sysincludepaths=""
|
tcc_sysincludepaths=""
|
||||||
tcc_libpaths=""
|
tcc_libpaths=""
|
||||||
tcc_crtprefix=""
|
tcc_crtprefix=""
|
||||||
@ -53,6 +54,7 @@ targetos=`uname`
|
|||||||
case $targetos in
|
case $targetos in
|
||||||
Darwin)
|
Darwin)
|
||||||
confvars="$confvars OSX"
|
confvars="$confvars OSX"
|
||||||
|
tcc_usrinclude="`xcrun --show-sdk-path`/usr/include"
|
||||||
DLLSUF=".dylib"
|
DLLSUF=".dylib"
|
||||||
;;
|
;;
|
||||||
Windows_NT|MINGW*|MSYS*|CYGWIN*)
|
Windows_NT|MINGW*|MSYS*|CYGWIN*)
|
||||||
@ -401,6 +403,7 @@ fcho "Manual directory " "$mandir"
|
|||||||
fcho "Info directory " "$infodir"
|
fcho "Info directory " "$infodir"
|
||||||
fcho "Doc directory " "$docdir"
|
fcho "Doc directory " "$docdir"
|
||||||
fcho "Target root prefix " "$sysroot"
|
fcho "Target root prefix " "$sysroot"
|
||||||
|
fcho "/usr/include dir " "$tcc_usrinclude"
|
||||||
echo "Source path $source_path"
|
echo "Source path $source_path"
|
||||||
echo "C compiler $cc ($gcc_major.$gcc_minor)"
|
echo "C compiler $cc ($gcc_major.$gcc_minor)"
|
||||||
echo "Target OS $targetos"
|
echo "Target OS $targetos"
|
||||||
@ -455,6 +458,7 @@ echo "/* Automatically generated by configure - do not modify */" > $TMPH
|
|||||||
|
|
||||||
print_inc CONFIG_SYSROOT "$sysroot"
|
print_inc CONFIG_SYSROOT "$sysroot"
|
||||||
print_inc CONFIG_TCCDIR "$tccdir"
|
print_inc CONFIG_TCCDIR "$tccdir"
|
||||||
|
print_mak CONFIG_USR_INCLUDE "$tcc_usrinclude"
|
||||||
print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
|
print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
|
||||||
print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
|
print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
|
||||||
print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
|
print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
|
||||||
|
@ -17,10 +17,6 @@ XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP)
|
|||||||
XCFG = $(or $(findstring -win,$T),-unx)
|
XCFG = $(or $(findstring -win,$T),-unx)
|
||||||
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
||||||
|
|
||||||
ifdef CONFIG_OSX
|
|
||||||
XFLAGS += -I`xcrun --show-sdk-path`/usr/include
|
|
||||||
endif
|
|
||||||
|
|
||||||
# in order to use gcc, type: make <target>-libtcc1-usegcc=yes
|
# in order to use gcc, type: make <target>-libtcc1-usegcc=yes
|
||||||
arm-libtcc1-usegcc ?= no
|
arm-libtcc1-usegcc ?= no
|
||||||
|
|
||||||
|
7
tcc.h
7
tcc.h
@ -22,6 +22,7 @@
|
|||||||
#define _TCC_H
|
#define _TCC_H
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
#define _DARWIN_C_SOURCE
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -217,6 +218,10 @@ extern long double strtold (const char *__nptr, char **__endptr);
|
|||||||
# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
|
# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_USR_INCLUDE
|
||||||
|
# define CONFIG_USR_INCLUDE "/usr/include"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */
|
/* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */
|
||||||
|
|
||||||
/* system include paths */
|
/* system include paths */
|
||||||
@ -227,7 +232,7 @@ extern long double strtold (const char *__nptr, char **__endptr);
|
|||||||
# define CONFIG_TCC_SYSINCLUDEPATHS \
|
# define CONFIG_TCC_SYSINCLUDEPATHS \
|
||||||
"{B}/include" \
|
"{B}/include" \
|
||||||
":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \
|
":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \
|
||||||
":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/include")
|
":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -15,9 +15,6 @@ endif
|
|||||||
ifdef CONFIG_OSX
|
ifdef CONFIG_OSX
|
||||||
SKIP += 40_stdio.test 42_function_pointer.test
|
SKIP += 40_stdio.test 42_function_pointer.test
|
||||||
SKIP += 113_btdll.test # no shared lib support yet
|
SKIP += 113_btdll.test # no shared lib support yet
|
||||||
FLAGS += -w
|
|
||||||
SDK := `xcrun --show-sdk-path`
|
|
||||||
TCCFLAGS += -I$(SDK)/usr/include
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(ARCH),x86_64)
|
ifeq ($(ARCH),x86_64)
|
||||||
SKIP += 73_arm64.test
|
SKIP += 73_arm64.test
|
||||||
|
Loading…
Reference in New Issue
Block a user