wehfou/Makefile

39 lines
805 B
Makefile
Raw Permalink Normal View History

2022-04-01 17:37:59 +02:00
CC ?= gcc
2022-04-01 18:31:34 +02:00
CFLAGS = -std=c99 -Wall -Wextra -Os -I./inc -MMD $(shell sdl2-config --cflags)
2022-04-01 17:37:59 +02:00
LDFLAGS = -lSDL2 -lSDL2_image -lSDL2_mixer $(shell sdl2-config --libs)
OBJ_NAME = wehfou
OBJS := $(patsubst %.c,%.o,$(wildcard src/*.c))
2022-04-01 18:31:34 +02:00
LVLS_BIN = inc/levels_bin.h
LVLS := $(wildcard res/*.kble)
2022-04-01 17:37:59 +02:00
2022-04-01 18:31:34 +02:00
all: $(LVLS_BIN) $(OBJ_NAME)
2022-04-01 17:37:59 +02:00
$(OBJ_NAME): $(OBJS)
$(CC) $(LDFLAGS) $(LIBRARIES) -o $(OBJ_NAME) $(OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
2022-04-01 18:31:34 +02:00
$(LVLS_BIN): $(LVLS)
cembed -o $(LVLS_BIN) -t levels $(LVLS)
cg: $(LVLS_BIN)
2022-04-01 17:37:59 +02:00
fxsdk build-cg
2022-04-01 18:31:34 +02:00
run: all
2022-04-01 17:37:59 +02:00
./$(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)
2022-04-01 18:31:34 +02:00
rm -f $(LVLS_BIN) $(OBJS) src/*.d
2022-04-01 17:37:59 +02:00
rm -Rf build-cg
.PHONY: cg run run-txt format clean
-include src/*.d