2015-03-22 14:16:21 -04:00
|
|
|
# CC, EXT, and BUILD may be overridden by a top level makefile (e.g. for
|
|
|
|
# cross compiling)
|
|
|
|
CC = gcc
|
|
|
|
EXT =
|
|
|
|
BUILD = ./obj
|
|
|
|
|
|
|
|
TARGET = spinsim$(EXT)
|
2015-03-22 13:30:10 -04:00
|
|
|
|
|
|
|
SOURCES = spinsim.c spininterp.c spindebug.c pasmsim.c pasmdebug.c pasmsim2.c pasmdebug2.c eeprom.c debug.c gdb.c
|
|
|
|
|
|
|
|
ifneq ($(OS),msys)
|
|
|
|
SOURCES += conion.c
|
|
|
|
endif
|
|
|
|
|
2015-03-22 14:16:21 -04:00
|
|
|
OBJECTS = $(patsubst %,$(BUILD)/%, $(SOURCES:.c=.o))
|
|
|
|
|
2015-03-22 13:30:10 -04: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
|
|
|
|
LDFLAGS =
|
|
|
|
OPT := -O3
|
2015-03-22 14:16:21 -04:00
|
|
|
CFLAGS = -c -g -Wall -Wno-format $(OPT) -D LINUX
|
|
|
|
|
|
|
|
all: directory $(SOURCES) $(OBJECTS) Makefile
|
|
|
|
$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS)
|
2015-03-22 13:30:10 -04:00
|
|
|
|
2015-03-22 14:16:21 -04:00
|
|
|
directory:
|
|
|
|
mkdir -p $(BUILD)
|
2015-03-22 13:30:10 -04:00
|
|
|
|
|
|
|
# Compile .c files into objexts .o
|
2015-03-22 14:16:21 -04:00
|
|
|
$(BUILD)/%.o: %.c
|
2015-03-22 13:30:10 -04:00
|
|
|
$(CC) $(CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
clean: FORCE
|
|
|
|
rm -f *.o $(TARGET)
|
|
|
|
FORCE:
|