First commit
This commit is contained in:
39
Makefile
Normal file
39
Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
CXX = g++
|
||||
BUILD = .build
|
||||
TARGET = emulator
|
||||
OPT = g -g
|
||||
DEFINE = -DCPU_Z80_STATIC -DCPU_Z80_USE_LOCAL_HEADER
|
||||
|
||||
CFLAGS = -Wall -Wextra -std=c++20 -O$(OPT) $(DEFINE) -flto -Iinclude `sdl2-config --cflags` -Ilibs/z80/API/emulation/CPU -Ilibs/z/API
|
||||
LDFLAGS = -Wall -Wextra -O$(OPT) -flto `sdl2-config --libs` -lSDL2_image
|
||||
|
||||
SRC = \
|
||||
src/main.cpp \
|
||||
libs/z80/sources/Z80.c \
|
||||
|
||||
OBJ_1 = $(notdir $(SRC:.cpp=.o))
|
||||
OBJ_2 = $(notdir $(OBJ_1:.c=.o))
|
||||
OBJ = $(addprefix $(BUILD)/, $(OBJ_2))
|
||||
# We can't use this as it will use the wrong main
|
||||
# vpath %.c $(sort $(dir $(SRC)))
|
||||
vpath %.cpp $(dir $(SRC))
|
||||
vpath %.c $(dir $(SRC))
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(BUILD) $(BUILD)/$(TARGET)
|
||||
|
||||
$(BUILD)/%.o: %.cpp Makefile | $(BUILD)
|
||||
$(CXX) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD)/%.o: %.c Makefile | $(BUILD)
|
||||
$(CXX) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD)/$(TARGET): $(OBJ) Makefile
|
||||
$(CXX) $(LDFLAGS) $(OBJ) -o $@
|
||||
|
||||
$(BUILD):
|
||||
mkdir $@
|
||||
|
||||
clean:
|
||||
rm -fr $(BUILD)
|
||||
Reference in New Issue
Block a user