Skip to content

Commit eef70dc

Browse files
committed
Totally new Makefile system
1 parent 95c3af2 commit eef70dc

15 files changed

+1862
-1784
lines changed

Makefile

+20-50
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ DISABLE_ERROR_LOGGING = 1
55
IS_X86 = 0
66
TARGET_NAME = mame2000
77

8+
CORE_DIR = .
89
GCC_DEFINES := -Wno-sign-compare -Wunused -Wpointer-arith -Waggregate-return -Wshadow -Werror=implicit-function-declaration
910

1011
ifeq ($(platform),)
@@ -40,7 +41,7 @@ endif
4041
ifeq ($(platform), unix)
4142
TARGET := $(TARGET_NAME)_libretro.so
4243
fpic := -fPIC
43-
SHARED := -shared -Wl,--version-script=src/libretro/link.T -Wl,-no-undefined
44+
SHARED := -shared -Wl,--version-script=link.T -Wl,-no-undefined
4445
ifneq ($(ARM), 1)
4546
IS_X86 = 1
4647
endif
@@ -153,7 +154,7 @@ else ifeq ($(platform), ctr)
153154
else
154155
TARGET := $(TARGET_NAME)_libretro.dll
155156
CC = gcc
156-
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=src/libretro/link.T
157+
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T
157158
CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ -Wno-missing-field-initializers
158159
IS_X86 = 1
159160
endif
@@ -169,78 +170,47 @@ else
169170
CFLAGS += -O3
170171
endif
171172

172-
173-
# set this the operating system you're building for
174-
MAMEOS = libretro
175-
176-
# CPU core include paths
177-
VPATH=src $(wildcard src/cpu/*)
178-
179173
# compiler, linker and utilities
180-
MD = @mkdir -p
181174
RM = rm -f
182-
183-
EMULATOR = $(TARGET)
184-
185-
DEFS = -DGP2X -DALIGN_INTS -DALIGN_SHORTS -DINLINE="static __inline" $(X86_DEFINES) -DMAME_UNDERCLOCK -DMAME_FASTSOUND -DENABLE_AUTOFIRE -DBIGCASE -D__LIBRETRO__ $(ENDIANNESS_DEFINES)
186-
187175
LIBS = -lm
188-
189176
OBJ = obj
190177

191178
ifeq ($(HAVE_RZLIB),)
192179
ZLIB_INCLUDE := -Isrc/zlib
193180
endif
194181

195-
196-
CFLAGS += -ffast-math $(fpic) $(PLATFORM_DEFINES) -Isrc -Isrc/$(MAMEOS) $(ZLIB_INCLUDE) $(GCC_DEFINES)
197-
198-
OBJDIRS = $(OBJ) $(OBJ)/cpu $(OBJ)/sound $(OBJ)/$(MAMEOS) \
199-
$(OBJ)/drivers $(OBJ)/machine $(OBJ)/vidhrdw $(OBJ)/sndhrdw $(OBJ)/zlib
200-
201-
all: maketree $(EMULATOR)
182+
INCFLAGS :=
202183

203184
# include the various .mak files
204-
include src/core.mak
205-
include src/mame.mak
206-
include src/rules.mak
207-
include src/sound.mak
208-
include src/$(MAMEOS)/$(MAMEOS).mak
185+
include Makefile.common
209186

187+
DEFS += -ffast-math $(fpic) $(PLATFORM_DEFINES) $(ZLIB_INCLUDE) $(GCC_DEFINES) $(INCFLAGS)
210188
# combine the various definitions to one
211-
CDEFS = $(DEFS) $(COREDEFS) $(CPUDEFS) $(SOUNDDEFS)
189+
CDEFS += -DGP2X -DALIGN_INTS -DALIGN_SHORTS -DINLINE="static __inline" $(X86_DEFINES) -DMAME_UNDERCLOCK -DMAME_FASTSOUND -DENABLE_AUTOFIRE -DBIGCASE -D__LIBRETRO__ $(ENDIANNESS_DEFINES)$(DEFS) $(COREDEFS) $(CPUDEFS) $(SOUNDDEFS)
212190

213-
ifeq ($(HAVE_RZLIB),1)
214-
OBJS := $(COREOBJS) $(OSOBJS) $(DRVOBJS)
215-
else
216-
OBJS := $(ZLIBOBJS) $(COREOBJS) $(OSOBJS) $(DRVOBJS)
217-
endif
218191

219-
$(EMULATOR): $(OBJS)
192+
OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_ASM:.s=.o)
193+
194+
all: $(TARGET)
195+
196+
$(TARGET): $(OBJECTS)
220197
ifeq ($(STATIC_LINKING), 1)
221-
$(AR) rcs $@ $(OBJS)
198+
$(AR) rcs $@ $(OBJECTS)
222199
else
223200
@echo Linking $@...
224-
$(CC) $(SHARED) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
201+
$(CC) $(SHARED) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
225202
endif
226203

227-
$(OBJ)/%.o: src/%.c
228-
@echo Compiling $<...
204+
%.o: %.c
229205
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
230206

231-
$(OBJ)/%.o: src/%.s
232-
@echo Compiling $<...
207+
%.o: %.s
233208
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
234209

235-
$(OBJ)/%.o: src/%.S
236-
@echo Compiling $<...
210+
%.o: %.S
237211
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
238212

239-
$(sort $(OBJDIRS)):
240-
$(MD) $@
241-
242-
maketree: $(sort $(OBJDIRS))
243-
244213
clean:
245-
$(RM) -r $(OBJ)
246-
$(RM) $(EMULATOR)
214+
rm -f $(OBJECTS) $(TARGET)
215+
216+
.PHONY: clean

0 commit comments

Comments
 (0)