2024-10-10 20:11:57 +08:00
|
|
|
CC = gcc
|
|
|
|
|
|
|
|
OBJD = obj
|
|
|
|
SRCS := $(wildcard *.c)
|
|
|
|
OBJS := $(SRCS:%.c=$(OBJD)/%.o)
|
|
|
|
|
|
|
|
# Compiler flags
|
|
|
|
CCFLAGS = -g
|
|
|
|
LDFLAGS = -lSDL2 -lSDL2_image -lSDL2_ttf
|
|
|
|
|
|
|
|
# Target executable name
|
|
|
|
TARGET = main
|
|
|
|
|
|
|
|
# Build target
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
$(CC) $(CCFLAGS) $^ -o $(TARGET) $(LDFLAGS)
|
|
|
|
|
|
|
|
$(OBJS): $(OBJD)/%.o: %.c
|
|
|
|
mkdir -p $(@D)
|
|
|
|
$(CC) $(CCFLAGS) -c $? -o $@
|
|
|
|
|
2024-10-13 22:43:33 +08:00
|
|
|
TARGET1 = test
|
|
|
|
|
|
|
|
$(TARGET1): example-test-code/audiotest.c
|
|
|
|
$(CC) $(CCFLAGS) $^ -o $(TARGET1) $(LDFLAGS)
|
|
|
|
|
2024-10-10 20:11:57 +08:00
|
|
|
clean:
|
2024-10-13 22:43:33 +08:00
|
|
|
rm -r $(TARGET) $(TARGET1) $(test) $(OBJD)
|
2024-10-10 20:11:57 +08:00
|
|
|
|
|
|
|
run: $(TARGET)
|
|
|
|
./$(TARGET)
|
|
|
|
|