aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 19 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 1750a40..0879247 100644
--- a/Makefile
+++ b/Makefile
@@ -8,11 +8,6 @@ VPATH = $(top_srcdir)
CPPFLAGS = -I$(TOP) # for config.h
-CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
-CFLAGS_P=$(CFLAGS) -pg -static
-LIBS_P=
-LDFLAGS_P=$(LDFLAGS)
-
ifeq (-$(findstring $(GCC_MAJOR),01)-,--)
CFLAGS+=-fno-strict-aliasing
ifeq (-$(findstring $(GCC_MAJOR),23)-,--)
@@ -23,12 +18,17 @@ else
CFLAGS+=-Wno-unused-result
endif
endif
-endif
-
+else # not GCC
+ifeq (-$(findstring clang,$(CC))-,-clang-)
# make clang accept gnuisms in libtcc1.c
-ifeq ($(CC),clang)
CFLAGS+=-fheinous-gnu-extensions
endif
+endif
+
+CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
+CFLAGS_P=$(CFLAGS) -pg -static
+LIBS_P=
+LDFLAGS_P=$(LDFLAGS)
ifdef CONFIG_WIN64
CONFIG_WIN32=yes
@@ -41,31 +41,6 @@ LIBS+=-ldl
endif
endif
-ifeq ($(ARCH),i386)
-NATIVE_DEFINES+=-DTCC_TARGET_I386
-else ifeq ($(ARCH),x86-64)
-NATIVE_DEFINES+=-DTCC_TARGET_X86_64
-endif
-
-ifeq ($(ARCH),arm)
-NATIVE_DEFINES+=-DTCC_TARGET_ARM
-NATIVE_DEFINES+=-DWITHOUT_LIBTCC
-ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3))
-NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
-else ifneq (,$(wildcard /lib/ld-linux.so.3))
-NATIVE_DEFINES+=-DTCC_ARM_EABI
-endif
-NATIVE_DEFINES+=$(if $(shell grep -l "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo),-DTCC_ARM_VFP)
-endif
-
-ifdef CONFIG_WIN32
-NATIVE_DEFINES+=-DTCC_TARGET_PE
-endif
-
-ifneq ($(wildcard /lib/ld-uClibc.so.0),)
-NATIVE_DEFINES+=-DTCC_UCLIBC
-endif
-
# make libtcc as static or dynamic library?
ifdef DISABLE_STATIC
LIBTCC=libtcc.so.1.0
@@ -78,6 +53,17 @@ LIBTCC=libtcc.a
LINK_LIBTCC=
endif
+CONFIG_$(ARCH) = yes
+NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386
+NATIVE_DEFINES_$(CONFIG_x86-64) += -DTCC_TARGET_X86_64
+NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE
+NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC
+NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM -DWITHOUT_LIBTCC
+NATIVE_DEFINES_$(CONFIG_arm_eabihf) += -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
+NATIVE_DEFINES_$(CONFIG_arm_eabi) += -DTCC_ARM_EABI
+NATIVE_DEFINES_$(CONFIG_arm_vfp) += -DTCC_ARM_VFP
+NATIVE_DEFINES += $(NATIVE_DEFINES_yes)
+
ifeq ($(TOP),.)
PROGS=tcc$(EXESUF)