mirror of
https://github.com/niellun/FastCarPlay.git
synced 2026-07-29 09:28:49 +02:00
Initial commit. Version 0.1
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# Compiler
|
||||
CXX := g++
|
||||
SRC_DIR := ./src
|
||||
OUT_DIR := ./out
|
||||
RES_DIR := $(SRC_DIR)/resource
|
||||
GEN_DIR := $(SRC_DIR)/autogen
|
||||
BUILD_DIR := $(OUT_DIR)/$(BUILD_TYPE)
|
||||
|
||||
# File lists
|
||||
SRCS := $(shell find $(SRC_DIR) -type f -name '*.cpp')
|
||||
OBJS=$(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRCS))
|
||||
|
||||
RES := $(shell find $(RES_DIR) -type f ! -name '*.h' -name '*.*')
|
||||
RES_SRC := $(patsubst $(RES_DIR)/%,$(GEN_DIR)/%.cpp,$(RES))
|
||||
|
||||
# Targets
|
||||
TARGET_NAME := app
|
||||
|
||||
# Build types
|
||||
.PHONY: all debug release clean build
|
||||
|
||||
all: debug
|
||||
|
||||
LDOPTIONS := -lSDL2 -lSDL2_ttf -lavformat -lavcodec -lavutil -lswscale -lusb-1.0
|
||||
LDFLAGS :=
|
||||
CXXCOMMON := -Wall -Isrc
|
||||
|
||||
debug: BUILD_TYPE := debug
|
||||
debug: CXXFLAGS := -g -O0 -fsanitize=address -fno-omit-frame-pointer
|
||||
debug: LDFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
||||
debug: TARGET := $(TARGET_NAME)-debug
|
||||
debug: prepare
|
||||
|
||||
release: BUILD_TYPE := release
|
||||
release: CXXFLAGS := -O2
|
||||
release: TARGET := $(TARGET_NAME)
|
||||
release: prepare
|
||||
|
||||
prepare: $(RES_SRC)
|
||||
$(MAKE) BUILD_TYPE=$(BUILD_TYPE) TARGET=$(OUT_DIR)/$(TARGET) CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" build
|
||||
|
||||
build: $(TARGET)
|
||||
|
||||
$(GEN_DIR)/%.cpp: $(RES_DIR)/%
|
||||
@mkdir -p $(GEN_DIR)
|
||||
xxd -i -n $(basename $(notdir $<)) $< > $@
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
@mkdir -p $(OUT_DIR)
|
||||
$(CXX) $(LDFLAGS) $(OBJS) -o $(TARGET) $(LDOPTIONS)
|
||||
@echo "Build complete: $(TARGET)"
|
||||
|
||||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXCOMMON) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
@rm -rf $(OUT_DIR)
|
||||
@rm -rf $(GEN_DIR)
|
||||
@echo "Clean complete"
|
||||
Reference in New Issue
Block a user