Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Project name
- PROJ_NAME := BIGBOSS_SDL2
- # C++ compiler
- CPPC := clang++
- # Linker
- LNK := ld
- # C compiler
- CC := clang
- # Archiver
- AS := llvm-ar
- # Objcopy
- OBJCOPY := objcopy
- # Output directory, by default is build
- ifeq ($(OUT_DIR),)
- OUT_DIR := Build
- endif
- # Source directory
- SRC_DIR := source
- # Include directory paths
- I_DIRS := -I$(OO_PS4_TOOLCHAIN)/include -Iinclude
- # Library directory paths
- L_DIRS := -L. -L$(OO_PS4_TOOLCHAIN)/lib
- # Included libraries
- LIBS := -lc -lm
- # Orbis flags
- ORB_VER := -D_DEBUG -D__ORBIS__ -D__PS4__
- # C++ Flags
- CFLAGS := $(I_DIRS) $(ORB_VER) -g -std=c11 -O0 -msse2 -mavx -target x86_64-scei-ps4 -Wall -Werror -Wno-unknown-pragmas
- # Assembly flags
- SFLAGS :=
- # Linker flags
- LFLAGS := -v $(L_DIRS) -nostdlib
- # Calculate the listing of all file paths
- CFILES := $(wildcard $(SRC_DIR)/*.c)
- CPPFILES := $(wildcard $(SRC_DIR)/*.cpp)
- SFILES := $(wildcard $(SRC_DIR)/*.s)
- OBJS := $(patsubst $(SRC_DIR)/%.s, $(OUT_DIR)/$(SRC_DIR)/%.o, $(SFILES)) $(patsubst $(SRC_DIR)/%.c, $(OUT_DIR)/$(SRC_DIR)/%.o, $(CFILES)) $(patsubst $(SRC_DIR)/%.cpp, $(OUT_DIR)/$(SRC_DIR)/%.o, $(CPPFILES))
- ALL_CPP := $(shell find $(SRC_DIR)/ -type f -name '*.cpp')
- ALL_C := $(shell find $(SRC_DIR)/ -type f -name '*.c')
- ALL_S := $(shell find $(SRC_DIR)/ -type f -name '*.s')
- ALL_SOURCES := $(ALL_S) $(ALL_C) $(ALL_CPP)
- TO_BUILD := $(ALL_S:$(SRC_DIR)%=$(OUT_DIR)/$(SRC_DIR)%) $(ALL_C:$(SRC_DIR)%=$(OUT_DIR)/$(SRC_DIR)%) $(ALL_CPP:$(SRC_DIR)%=$(OUT_DIR)/$(SRC_DIR)%)
- ALL_OBJ_CPP := $(TO_BUILD:.cpp=.o)
- ALL_OBJ_C := $(ALL_OBJ_CPP:.c=.o)
- ALL_OBJ := $(ALL_OBJ_C:.s=.o)
- # Target elf name
- TARGET = "$(PROJ_NAME).elf"
- # Target payload name (data + text only, no elf)
- PAYLOAD = "$(PROJ_NAME).bin"
- $(TARGET): $(ALL_OBJ)
- @echo Compiling $(PROJ_NAME)...
- @$(CC) $(ALL_OBJ) -o $(OUT_DIR)/$(TARGET) $(LFLAGS) $(LIBS)
- $(OUT_DIR)/$(SRC_DIR)/%.o: $(SRC_DIR)/%.c
- @echo "Compiling $< ..."
- @clang-tidy -checks=clang-analyzer-*,bugprone-*,portability-*,cert-* $< -- $(I_DIRS) $(C_DEFS)
- @$(CC) $(CFLAGS) $(IDIRS) -c $< -o $@
- $(OUT_DIR)/$(SRC_DIR)/%.o: $(SRC_DIR)/%.cpp
- @echo "Compiling $< ..."
- @clang-tidy -checks=clang-analyzer-*,bugprone-*,portability-*,cert-* $< -- $(I_DIRS) $(C_DEFS)
- @$(CPPC) $(CFLAGS) $(IDIRS) -c $< -o $@
- $(OUT_DIR)/$(SRC_DIR)/%.o: $(SRC_DIR)/%.s
- @echo "Compiling $< ..."
- @$(CC) -c -o $@ $< $(SFLAGS)
- .PHONY: clean
- clean:
- @echo "Cleaning project..."
- @rm -f $(TARGET) $(PAYLOAD) $(shell find $(OUT_DIR)/ -type f -name '*.o') $(shell find $(OUT_DIR)/ -type f -name '*.bin') $(shell find $(OUT_DIR)/ -type f -name '*.elf')
- create:
- @echo "Creating directories..."
- @mkdir -p $(shell find '$(SRC_DIR)/' -type d -printf '$(OUT_DIR)/%p\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement