about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b536ba0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+PKGS = sdl2
+CFLAGS = -O3 -Wall -Wold-style-definition -ggdb -std=c11 -pedantic `pkg-config --cflags $(PKGS)`
+LIBS = `pkg-config --libs sdl2` -lm
+
+# Source files for the simulator
+SIM_SRC = $(wildcard src/simulator/*.c) src/game.c
+SIM_OBJ = $(SIM_SRC:.c=.o)
+
+# Source files for the trainer
+TRAIN_SRC = $(wildcard src/trainer/*.c) src/game.c
+TRAIN_OBJ = $(TRAIN_SRC:.c=.o)
+
+# Source files for the inspector
+INSPECT_SRC = $(wildcard src/inspector/*.c) src/game.c
+INSPECT_OBJ = $(INSPECT_SRC:.c=.o)
+
+
+# Targets for the executables
+all: gp-simulator gp-trainer gp-inspector
+
+gp-simulator: $(SIM_OBJ)
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
+gp-trainer: $(TRAIN_OBJ)
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
+gp-inspector: $(INSPECT_OBJ)
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
+# Pattern rule for object files
+%.o: %.c
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+clean:
+	rm -f $(SIM_OBJ) gp-simulator
+	rm -f $(TRAIN_OBJ) gp-trainer
+	rm -f $(INSPECT_OBJ) gp-inspector
+	rm -f log.dat