History

gcc options and mingw: move a gcc options detection from a makefile to the configure + define XCC and XAR if mingw32 defined + use XCC and XAR in lib/Makefile if defined Try "./configure --enable-mingw32; make". This must work

seyko committed 11 years ago

Commit 48d12e41 parent 76af9483 files · +20 −18Browse files

Unified · Split

3 files
  1. Makefile +1 −13
  2. configure +16 −2
  3. lib/Makefile +3 −3
Makefile+1−13
@@ -8,19 +8,7 @@ VPATH = $(top_srcdir) · 7 unmodified lines
88
99 CPPFLAGS += -I$(TOP) # for config.h
1010
11−ifeq (-$(findstring gcc,$(CC))-,-gcc-)
12−ifeq (-$(findstring $(GCC_MAJOR),01)-,--)
13−CFLAGS+=-fno-strict-aliasing
14−ifeq (-$(findstring $(GCC_MAJOR),23)-,--)
15−CFLAGS+=-Wno-pointer-sign -Wno-sign-compare
16−ifeq (-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-4--)
17−CFLAGS+=-D_FORTIFY_SOURCE=0
18−else
19−CFLAGS+=-Wno-unused-result
20−endif
21−endif
22−endif
23−else # not GCC
11+ifneq (-$(findstring gcc,$(CC))-,-gcc-)
2412 ifeq (-$(findstring clang,$(CC))-,-clang-)
2513 # make clang accept gnuisms in libtcc1.c
2614 CFLAGS+=-fheinous-gnu-extensions
configure+16−2
@@ -373,8 +373,16 @@ else · 372 unmodified lines
373373 fi
374374
375375 # a final configuration tuning
376−W_PRESENT="$($cc -v --help 2>&1 | grep deprecated-declarations)"
377−if test -n "$W_PRESENT"; then cc="$cc -Wno-deprecated-declarations"; fi
376+W_OPTIONS="deprecated-declarations strict-aliasing pointer-sign sign-compare unused-result uninitialized"
377+for i in $W_OPTIONS; do
378+ O_PRESENT="$($cc -v --help 2>&1 | grep -- -W$i)"
379+ if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -Wno-$i"; fi
380+done
381+F_OPTIONS="strict-aliasing"
382+for i in $F_OPTIONS; do
383+ O_PRESENT="$($cc -v --help 2>&1 | grep -- -f$i)"
384+ if test -n "$O_PRESENT"; then CFLAGS="$CFLAGS -fno-$i"; fi
385+done
378386 if test -z "$tcc_lddir" -a "$cpu" = "x86-64"; then tcc_lddir="lib64"; fi
379387
380388 echo "Binary directory $bindir"
@@ -420,6 +428,12 @@ LDFLAGS=$LDFLAGS · 39 unmodified lines
420428 LIBSUF=$LIBSUF
421429 EXESUF=$EXESUF
422430 EOF
431+if test "$mingw32" = "yes"; then
432+cat >>config.mak <<EOF
433+XCC=$cc
434+XAR=$ar
435+EOF
436+fi
423437
424438 print_inc() {
425439 if test -n "$2"; then
lib/Makefile+3−3
@@ -60,15 +60,15 @@ CFLAGS := $(filter-out -fstack-protector-strong,$(CFLAGS)) · 59 unmodified lines
6060 ifeq "$(TARGET)" "i386-win"
6161 OBJ = $(addprefix $(DIR)/,$(WIN32_O))
6262 TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
63− XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
64− XAR = $(DIR)/tiny_libmaker$(EXESUF)
63+ XCC ?= $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
64+ XAR ?= $(DIR)/tiny_libmaker$(EXESUF)
6565 PICFLAGS =
6666 else
6767 ifeq "$(TARGET)" "x86_64-win"
6868 OBJ = $(addprefix $(DIR)/,$(WIN64_O))
6969 TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
7070 XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
71− XAR = $(DIR)/tiny_libmaker$(EXESUF)
71+ XAR ?= $(DIR)/tiny_libmaker$(EXESUF)
7272 PICFLAGS =
7373 else
7474 ifeq "$(TARGET)" "i386"

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