39 lines
805 B
Makefile
39 lines
805 B
Makefile
CC ?= gcc
|
|
CFLAGS = -std=c99 -Wall -Wextra -Os -I./inc -MMD $(shell sdl2-config --cflags)
|
|
LDFLAGS = -lSDL2 -lSDL2_image -lSDL2_mixer $(shell sdl2-config --libs)
|
|
|
|
OBJ_NAME = wehfou
|
|
OBJS := $(patsubst %.c,%.o,$(wildcard src/*.c))
|
|
LVLS_BIN = inc/levels_bin.h
|
|
LVLS := $(wildcard res/*.kble)
|
|
|
|
all: $(LVLS_BIN) $(OBJ_NAME)
|
|
|
|
$(OBJ_NAME): $(OBJS)
|
|
$(CC) $(LDFLAGS) $(LIBRARIES) -o $(OBJ_NAME) $(OBJS)
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
$(LVLS_BIN): $(LVLS)
|
|
cembed -o $(LVLS_BIN) -t levels $(LVLS)
|
|
|
|
cg: $(LVLS_BIN)
|
|
fxsdk build-cg
|
|
|
|
run: all
|
|
./$(OBJ_NAME)
|
|
|
|
format:
|
|
@clang-format -style=file -verbose -i src/*.c
|
|
@clang-format -style=file -verbose -i inc/*.h
|
|
|
|
clean:
|
|
rm -f $(OBJ_NAME).g3a $(OBJ_NAME)
|
|
rm -f $(LVLS_BIN) $(OBJS) src/*.d
|
|
rm -Rf build-cg
|
|
|
|
.PHONY: cg run run-txt format clean
|
|
|
|
-include src/*.d
|