# HG changeset patch # User Michael Pavone # Date 1470808172 25200 # Node ID 0eb4264c2287415d59c628ca52e5ee2b39ac404a # Parent cd6048e0397b2c629c41bc607cbec6b6988f90ba 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 diff -r cd6048e0397b -r 0eb4264c2287 Makefile --- 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