summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e371044
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,34 @@
+CC ?= gcc
+CFLAGS = -std=c99 -Wall -Wextra -O3 -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))
+
+all: $(OBJ_NAME)
+
+$(OBJ_NAME): $(OBJS)
+ $(CC) $(LDFLAGS) $(LIBRARIES) -o $(OBJ_NAME) $(OBJS)
+ strip $(OBJ_NAME)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+cg:
+ fxsdk build-cg
+
+run: $(OBJ_NAME)
+ ./$(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 $(OBJS) src/*.d
+ rm -Rf build-cg
+
+.PHONY: cg run run-txt format clean
+
+-include src/*.d