2015-04-02 21:38:40 +00:00
|
|
|
# cross compilation scheme taken from Eric Smith's spin2cpp compiler
|
|
|
|
# if CROSS is defined, we are building a cross compiler
|
|
|
|
# possible targets are: win32, rpi
|
|
|
|
|
|
|
|
ifeq ($(CROSS),win32)
|
2015-12-22 12:22:00 +00:00
|
|
|
CC=i686-w64-mingw32-gcc
|
|
|
|
CXX=i686-w64-mingw32-g++
|
2015-04-02 21:38:40 +00:00
|
|
|
EXT=.exe
|
2015-04-03 13:52:43 +00:00
|
|
|
BUILD=./build-win32
|
2018-04-14 11:46:30 +00:00
|
|
|
OS=msys
|
2015-04-02 21:38:40 +00:00
|
|
|
else ifeq ($(CROSS),rpi)
|
|
|
|
CC=arm-linux-gnueabihf-gcc
|
|
|
|
CXX=arm-linux-gnueabihf-g++
|
|
|
|
EXT=
|
2015-04-03 13:52:43 +00:00
|
|
|
BUILD=./build-rpi
|
2015-04-02 21:38:40 +00:00
|
|
|
else
|
|
|
|
CC=gcc
|
|
|
|
CXX=g++
|
|
|
|
EXT=
|
2015-04-03 13:52:43 +00:00
|
|
|
BUILD=./build
|
2015-04-02 21:38:40 +00:00
|
|
|
endif
|
2015-03-22 18:16:21 +00:00
|
|
|
|
2015-04-02 21:38:40 +00:00
|
|
|
TARGET = $(BUILD)/spinsim$(EXT)
|
2015-03-22 17:30:10 +00:00
|
|
|
|
2018-04-13 02:20:22 +00:00
|
|
|
SOURCES = spinsim.c spininterp.c spindebug.c pasmsim.c pasmdebug.c pasmsim2.c pasmdebug2.c eeprom.c debug.c gdb.c disasm2.c
|
2015-03-22 17:30:10 +00:00
|
|
|
|
2018-04-16 02:39:06 +00:00
|
|
|
ifneq ($(MSYSTEM),MINGW32)
|
2015-03-22 17:30:10 +00:00
|
|
|
ifneq ($(OS),msys)
|
|
|
|
SOURCES += conion.c
|
|
|
|
endif
|
2018-04-16 02:39:06 +00:00
|
|
|
endif
|
2015-03-22 17:30:10 +00:00
|
|
|
|
2015-03-22 18:16:21 +00:00
|
|
|
OBJECTS = $(patsubst %,$(BUILD)/%, $(SOURCES:.c=.o))
|
|
|
|
|
2015-03-22 17:30:10 +00:00
|
|
|
# I'm not sure why these linker flags were being used but the break the build on Mac OS X so I've
|
|
|
|
# commented them out for the time being
|
|
|
|
#LDFLAGS = -Wl,--relax -Wl,--gc-sections
|
2018-04-14 09:08:33 +00:00
|
|
|
LDFLAGS = -lm
|
2015-03-22 17:30:10 +00:00
|
|
|
OPT := -O3
|
2015-03-22 18:16:21 +00:00
|
|
|
CFLAGS = -c -g -Wall -Wno-format $(OPT) -D LINUX
|
|
|
|
|
|
|
|
all: directory $(SOURCES) $(OBJECTS) Makefile
|
2018-04-14 11:21:58 +00:00
|
|
|
$(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS)
|
2015-03-22 17:30:10 +00:00
|
|
|
|
2015-03-22 18:16:21 +00:00
|
|
|
directory:
|
|
|
|
mkdir -p $(BUILD)
|
2015-03-22 17:30:10 +00:00
|
|
|
|
|
|
|
# Compile .c files into objexts .o
|
2015-03-22 18:16:21 +00:00
|
|
|
$(BUILD)/%.o: %.c
|
2015-03-22 17:30:10 +00:00
|
|
|
$(CC) $(CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
clean: FORCE
|
2018-04-13 02:20:22 +00:00
|
|
|
rm -rf $(BUILD)
|
2015-03-22 17:30:10 +00:00
|
|
|
FORCE:
|