Last active
February 3, 2019 20:55
-
-
Save davidatroberts/8ade17be770e08172ca49f6f5ba474ec to your computer and use it in GitHub Desktop.
RS97 Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET := output.dge | |
TOOLCHAIN = /opt/rs97-toolchain | |
CPP := $(TOOLCHAIN)/bin/mipsel-linux-g++ | |
STRIP = $(TOOLCHAIN)/bin/mipsel-linux-strip | |
SRC_DIR = src | |
OBJ_DIR = obj | |
BIN_DIR = bin | |
SOURCES := $(wildcard $(SRC_DIR)/*.cpp) | |
SOURCES := $(filter-out $(wildcard $(SRC_DIR)/test*.cpp), $(SOURCES)) | |
OBJECTS := $(SOURCES:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o) | |
INCLUDE_DIR = -Iinclude -I$(TOOLCHAIN)/usr/include/ -I$(TOOLCHAIN)/mipsel-buildroot-linux-musl/sysroot/usr/include | |
LIBRARY_DIR = -Llib -L$(TOOLCHAIN)/usr/lib/ -L$(TOOLCHAIN)/mipsel-buildroot-linux-musl/sysroot/usr/lib | |
LIBRARIES = -lstdc++ -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer | |
CFLAGS = -DDINGUX -O2 -mips32 -DWANT_CRC32 -DANSI_GCC -DSDL_PATCH -DDINGOO | |
CPPFLAGS = $(CFLAGS) | |
$(BIN_DIR)/$(TARGET): $(OBJECTS) | |
@echo "Linking..." | |
@$(CPP) $(LD_FLAGS) -o $@ $(OBJECTS) $(LIBRARIES) | |
$(STRIP) --strip-all $(BIN_DIR)/$(TARGET) | |
@echo "Linked OK" | |
$(OBJECTS): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.cpp | |
@$(CPP) $(CFLAGS) $(INCLUDE_DIR) -c $< -o $@ | |
@echo "Compiled " $< | |
.PHONEY: clean | |
clean: | |
rm -f $(OBJECTS) | |
.PHONEY: remove | |
remove: clean | |
@$(rm) $(BIN_DIR)/$(TARGET) | |
.PHONEY: list | |
list: | |
@echo $(SOURCES) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment