Mercurial > repos > blastem
changeset 1073:0eb4264c2287
Make the Makefile more OpenBSD friendly. LTO is not supported on the super old version of GCC it uses. uname -m reports different names than Linux. compiler will return error on rather than just warning for unknown options
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 09 Aug 2016 22:49:32 -0700 |
parents | cd6048e0397b |
children | 3a0f684891ae |
files | Makefile |
diffstat | 1 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Tue Aug 09 21:29:49 2016 -0700 +++ b/Makefile Tue Aug 09 22:49:32 2016 -0700 @@ -32,7 +32,11 @@ endif #Darwin HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi) -CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value -Wno-logical-op-parentheses $(HAS_PROC) +CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value $(HAS_PROC) +ifeq ($(OS),Darwin) +#This should really be based on whether or not the C compiler is clang rather than based on the OS +CFLAGS+= -Wno-logical-op-parentheses +endif ifdef PORTABLE CFLAGS+= -DGLEW_STATIC -Iglew/include LDFLAGS:=-lm glew/lib/libGLEW.a @@ -61,8 +65,13 @@ CFLAGS:=-ggdb $(CFLAGS) LDFLAGS:=-ggdb $(LDFLAGS) else +ifdef NOLTO +CFLAGS:=-O2 $(CFLAGS) +LDFLAGS:=-O2 $(LDFLAGS) +else CFLAGS:=-O2 -flto $(CFLAGS) LDFLAGS:=-O2 -flto $(LDFLAGS) +endif #NOLTO endif #DEBUG ifdef Z80_LOG_ADDRESS @@ -91,6 +100,15 @@ CPU:=$(shell uname -m) endif +#OpenBSD uses different names for these architectures +ifeq ($(CPU),amd64) +CPU:=x86_64 +else +ifeq ($(CPU),i386) +CPU:=i686 +endif +endif + TRANSOBJS=gen.o backend.o $(MEM) arena.o M68KOBJS=68kinst.o m68k_core.o ifeq ($(CPU),x86_64) @@ -116,6 +134,8 @@ ifeq ($(CPU),i686) CFLAGS+=-DX86_32 -m32 LDFLAGS+=-m32 +else +$(error $(CPU) is not a supported architecture) endif endif