Mercurial > repos > blastem
comparison Makefile @ 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 | 01a91df5b87c |
children | 382614130914 |
comparison
equal
deleted
inserted
replaced
1072:cd6048e0397b | 1073:0eb4264c2287 |
---|---|
30 else | 30 else |
31 LIBS=sdl2 glew gl | 31 LIBS=sdl2 glew gl |
32 endif #Darwin | 32 endif #Darwin |
33 | 33 |
34 HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi) | 34 HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi) |
35 CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value -Wno-logical-op-parentheses $(HAS_PROC) | 35 CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value $(HAS_PROC) |
36 ifeq ($(OS),Darwin) | |
37 #This should really be based on whether or not the C compiler is clang rather than based on the OS | |
38 CFLAGS+= -Wno-logical-op-parentheses | |
39 endif | |
36 ifdef PORTABLE | 40 ifdef PORTABLE |
37 CFLAGS+= -DGLEW_STATIC -Iglew/include | 41 CFLAGS+= -DGLEW_STATIC -Iglew/include |
38 LDFLAGS:=-lm glew/lib/libGLEW.a | 42 LDFLAGS:=-lm glew/lib/libGLEW.a |
39 | 43 |
40 ifeq ($(OS),Darwin) | 44 ifeq ($(OS),Darwin) |
59 | 63 |
60 ifdef DEBUG | 64 ifdef DEBUG |
61 CFLAGS:=-ggdb $(CFLAGS) | 65 CFLAGS:=-ggdb $(CFLAGS) |
62 LDFLAGS:=-ggdb $(LDFLAGS) | 66 LDFLAGS:=-ggdb $(LDFLAGS) |
63 else | 67 else |
68 ifdef NOLTO | |
69 CFLAGS:=-O2 $(CFLAGS) | |
70 LDFLAGS:=-O2 $(LDFLAGS) | |
71 else | |
64 CFLAGS:=-O2 -flto $(CFLAGS) | 72 CFLAGS:=-O2 -flto $(CFLAGS) |
65 LDFLAGS:=-O2 -flto $(LDFLAGS) | 73 LDFLAGS:=-O2 -flto $(LDFLAGS) |
74 endif #NOLTO | |
66 endif #DEBUG | 75 endif #DEBUG |
67 | 76 |
68 ifdef Z80_LOG_ADDRESS | 77 ifdef Z80_LOG_ADDRESS |
69 CFLAGS+= -DZ80_LOG_ADDRESS | 78 CFLAGS+= -DZ80_LOG_ADDRESS |
70 endif | 79 endif |
87 CFLAGS+= -DM68010 | 96 CFLAGS+= -DM68010 |
88 endif | 97 endif |
89 | 98 |
90 ifndef CPU | 99 ifndef CPU |
91 CPU:=$(shell uname -m) | 100 CPU:=$(shell uname -m) |
101 endif | |
102 | |
103 #OpenBSD uses different names for these architectures | |
104 ifeq ($(CPU),amd64) | |
105 CPU:=x86_64 | |
106 else | |
107 ifeq ($(CPU),i386) | |
108 CPU:=i686 | |
109 endif | |
92 endif | 110 endif |
93 | 111 |
94 TRANSOBJS=gen.o backend.o $(MEM) arena.o | 112 TRANSOBJS=gen.o backend.o $(MEM) arena.o |
95 M68KOBJS=68kinst.o m68k_core.o | 113 M68KOBJS=68kinst.o m68k_core.o |
96 ifeq ($(CPU),x86_64) | 114 ifeq ($(CPU),x86_64) |
114 LDFLAGS+=-m64 | 132 LDFLAGS+=-m64 |
115 else | 133 else |
116 ifeq ($(CPU),i686) | 134 ifeq ($(CPU),i686) |
117 CFLAGS+=-DX86_32 -m32 | 135 CFLAGS+=-DX86_32 -m32 |
118 LDFLAGS+=-m32 | 136 LDFLAGS+=-m32 |
137 else | |
138 $(error $(CPU) is not a supported architecture) | |
119 endif | 139 endif |
120 endif | 140 endif |
121 | 141 |
122 ifdef NOZ80 | 142 ifdef NOZ80 |
123 CFLAGS+=-DNO_Z80 | 143 CFLAGS+=-DNO_Z80 |