Skip to content

Commit

Permalink
[Fix] build: Makefile: DJGPP: Set MPT_COMPILER_NO_O instead of OPTIMI…
Browse files Browse the repository at this point in the history
…ZE=none, to catch non-O optimization flags and properly support FLAVOUR suffixes again.

[Fix] build: Makefile: DJGPP: Add flavour suffixes for all OPTIMIZE options.


git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22089 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
manxorist committed Nov 2, 2024
1 parent b0ea1d0 commit b73d66f
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions build/make/config-djgpp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ CFLAGS_STDC = -std=gnu17
else
CFLAGS_STDC = -std=gnu11
endif
CXXFLAGS += $(CXXFLAGS_STDCXX) -fallow-store-data-races -fno-threadsafe-statics
CFLAGS += $(CFLAGS_STDC) -fallow-store-data-races
CXXFLAGS += $(CXXFLAGS_STDCXX)
CFLAGS += $(CFLAGS_STDC)
OVERWRITE_CXXFLAGS += -fallow-store-data-races -fno-threadsafe-statics
OVERWRITE_CFLAGS += -fallow-store-data-races

CPU?=generic/compatible

Expand Down Expand Up @@ -95,6 +97,8 @@ OPT_SIZEX := -Oz



ifeq ($(OPTIMIZE),default)

OPT_UARCH_EMUL := -Os # interpreter
OPT_UARCH_CISC := -Os # non-pipelined, scalar, in-order, optimize for size i386 am386
OPT_UARCH_PIPE := -Os # pipelined, scalar, in-order, optimize for size i486 am486 cx486slc
Expand Down Expand Up @@ -127,6 +131,17 @@ OPT_UARCH_OOOE_128 := -O3 # pipelined, super-scalar, out-of-order, optimiz
OPT_UARCH_COMP_128 := -O3 # recompiler
endif

else

OPT_UARCH_EMUL :=
OPT_UARCH_CISC :=
OPT_UARCH_PIPE :=
OPT_UARCH_SCAL :=
OPT_UARCH_OOOE :=
OPT_UARCH_COMP :=

endif



CACHE_386 :=64 # 0/64/128
Expand Down Expand Up @@ -394,25 +409,25 @@ CPUFLAGS := $($(CPU))

# parse CPU optimization options
ifeq ($(findstring -O3,$(CPUFLAGS)),-O3)
OPTIMIZE=none
MPT_COMPILER_NO_O=1
endif
ifeq ($(findstring -O2,$(CPUFLAGS)),-O2)
OPTIMIZE=none
MPT_COMPILER_NO_O=1
endif
ifeq ($(findstring -Os,$(CPUFLAGS)),-Os)
OPTIMIZE=none
MPT_COMPILER_NO_O=1
endif
ifeq ($(findstring -Oz,$(CPUFLAGS)),-Oz)
OPTIMIZE=none
MPT_COMPILER_NO_O=1
endif
ifeq ($(findstring -O1,$(CPUFLAGS)),-O1)
OPTIMIZE=none
MPT_COMPILER_NO_O=1
endif
ifeq ($(findstring -O0,$(CPUFLAGS)),-O0)
OPTIMIZE=none
MPT_COMPILER_NO_O=1
endif
ifeq ($(findstring -Og,$(CPUFLAGS)),-Og)
OPTIMIZE=none
MPT_COMPILER_NO_O=1
endif

# Handle the no-FPU case by linking DJGPP's own emulator.
Expand Down Expand Up @@ -456,7 +471,13 @@ ifeq ($(findstring -msse,$(CPUFLAGS)),-msse)
EXESUFFIX:=-SSE$(EXESUFFIX)
SOSUFFIX:=-SSE$(SOSUFFIX)
endif
ifeq ($(OPTIMIZE),size)
ifeq ($(OPTIMIZE),some)
EXESUFFIX:=-O1$(EXESUFFIX)
SOSUFFIX:=-O1$(SOSUFFIX)
else ifeq ($(OPTIMIZE),extrasize)
EXESUFFIX:=-Oz$(EXESUFFIX)
SOSUFFIX:=-Oz$(SOSUFFIX)
else ifeq ($(OPTIMIZE),size)
EXESUFFIX:=-Os$(EXESUFFIX)
SOSUFFIX:=-Os$(SOSUFFIX)
else ifeq ($(OPTIMIZE),speed)
Expand Down Expand Up @@ -512,6 +533,7 @@ IS_CROSS=1
MPT_COMPILER_NOVISIBILITY=1

# causes crashes on process shutdown with liballegro
MPT_COMPILER_NOSECTIONS=1
MPT_COMPILER_NOGCSECTIONS=1

MPT_COMPILER_NOALLOCAH=1
Expand Down

0 comments on commit b73d66f

Please sign in to comment.