Yokemate of Keyboards
Posts: 2408 from 2003/4/10
From: France
Hi MartinW,
this is an example of Makefile for a SDL3 project i have ported:
Code:
#
# Makefile for MorphOS C++ project
#
# Compiler and tools
CC = ppc-morphos-gcc-11
STRIP = ppc-morphos-strip
# Build date for version info
AMIGADATE = $(shell date +"%-d.%-m.%Y")
DEFINE = -pthread -fsigned-char -D__AMIGADATE__=\"$(AMIGADATE)\"
INCLUDE = -Iinclude
-I/gg/usr/local/include
-I/gg/usr/local/include/SDL3
-I/gg/usr/local/include/SDL3_mixer
-I/gg/usr/local/include/SDL3_ttf
-I/gg/usr/local/include/SDL3_image
# Compiler and linker flags
CFLAGS = -noixemul -O2 -Wall -fsigned-char $(INCLUDE) $(DEFINE)
LIBS = -noixemul -L/gg/usr/local/lib -lSDL3_mixer -lSDL3_image -lSDL3_ttf -lSDL3 -lGL -lstdc++ -pthread -lc -lm
# Executable name
TARGET = Wetris
# Find all .cpp source files in src directory
SRCS = $(wildcard src/*.c)
# Generate corresponding object file names
OBJS = $(SRCS:.c=.o)
# Default target
all: $(TARGET)
# Link object files to create executable
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
# Uncomment to strip debug symbols:
# $(STRIP) --strip-all $(TARGET)
# Compile .c files to .o object files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Remove all generated files
clean:
rm -f $(OBJS) $(TARGET)
# Generate assembly dump for debugging
dump:
objdump --disassemble-all --reloc $(TARGET) > $(TARGET).s
I hope could help you.