-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
54 lines (44 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# 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)
CC=i686-w64-mingw32-gcc
CXX=i686-w64-mingw32-g++
EXT=.exe
BUILD=./build-win32
OS=msys
else ifeq ($(CROSS),rpi)
CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++
EXT=
BUILD=./build-rpi
else
CC=gcc
CXX=g++
EXT=
BUILD=./build
endif
TARGET = $(BUILD)/spinsim$(EXT)
SOURCES = spinsim.c spininterp.c spindebug.c pasmsim.c pasmdebug.c pasmsim2.c pasmdebug2.c eeprom.c debug.c gdb.c disasm2.c
ifneq ($(MSYSTEM),MINGW32)
ifneq ($(OS),msys)
SOURCES += conion.c
endif
endif
OBJECTS = $(patsubst %,$(BUILD)/%, $(SOURCES:.c=.o))
# 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
LDFLAGS = -lm
OPT := -O3
CFLAGS = -c -g -Wall -Wno-format $(OPT) -D LINUX
all: directory $(SOURCES) $(OBJECTS) Makefile
$(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS)
directory:
mkdir -p $(BUILD)
# Compile .c files into objexts .o
$(BUILD)/%.o: %.c
$(CC) $(CFLAGS) $< -o $@
clean: FORCE
rm -rf $(BUILD)
FORCE: