aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSopár Adrián <adrian.sopar@protonmail.com>2024-06-20 09:28:14 +0200
committerSopár Adrián <adrian.sopar@protonmail.com>2024-06-20 09:28:14 +0200
commit74ea6dc86646cee9915292d73d8c7afef01ef3e0 (patch)
tree9a58866f7765dad8ba56f1f40b1fa031e9d2687d /Makefile
First commit. This is mostly the state of the project as I left it around the end of 2019.HEADmaster
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile83
1 files changed, 83 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8102aec
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,83 @@
+CC = gcc
+CFLAGS = -Isrc $$(ncursesw5-config --cflags)
+LIBS = $$(ncursesw5-config --libs)
+#LIBS = -lncursesw
+
+PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/man
+
+all: bin/maze
+
+debug: CFLAGS += -Wall -DEBUG -g
+debug: bin/maze
+
+app_sources = $(wildcard src/*.c src/game/*.c)
+app_objects = $(patsubst src/%.c, bin/%.o, $(app_sources))
+
+bin/maze: $(app_objects)
+ $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+
+bin/main.o: src/main.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/args.o: src/args.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/config.o: src/config.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/color.o: src/color.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/menu.o: src/menu.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/game/entry.o: src/game/entry.c bin/game
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/game/game.o: src/game/game.c bin/game
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/game/operations.o: src/game/operations.c bin/game
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/game/commands.o: src/game/commands.c bin/game
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/file.o: src/file.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/maze_generator.o: src/maze_generator.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/maze_solver.o: src/maze_solver.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin/utilities.o: src/utilities.c bin
+ $(CC) $(CFLAGS) -c $< -o $@
+
+bin:
+ mkdir -p $@
+
+bin/game:
+ mkdir -p $@
+
+clean:
+ rm -rf bin/*
+
+install: bin/maze
+ @echo INSTALL execuatble
+ mkdir -p $(PREFIX)/bin
+ cp $< $(PREFIX)/bin/maze
+ chmod 755 $(PREFIX)/bin/maze
+ @echo INSTALL man page
+ gzip -c doc/maze.1 > $(MANPREFIX)/man1/maze.1.gz
+ chmod 644 $(MANPREFIX)/man1/maze.1.gz
+
+uninstall:
+ @echo REMOVE execuatble
+ rm -f $(PREFIX)/bin/maze
+ @echo REMOVE man page
+ rm -f $(MANPREFIX)/man1/maze.1.gz
+
+.PHONY: clean install uninstall