aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
diff options
context:
space:
mode:
authoryzrh <yzrh@noema.org>2020-10-10 17:16:14 +0000
committeryzrh <yzrh@noema.org>2020-10-10 17:37:53 +0000
commitb9b74e88028f81e7b169a5e168102138e8c2c46c (patch)
tree2b8f9f8896db3a6871c56215acf71cb502fe7be4 /src/Makefile
downloadsnake-sdl-b9b74e88028f81e7b169a5e168102138e8c2c46c.tar.gz
snake-sdl-b9b74e88028f81e7b169a5e168102138e8c2c46c.tar.zst
Initial commit.
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..37533bd
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,50 @@
+# Copyright (c) 2019-2020, yzrh <yzrh@noema.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+src = main.c collision.c game.c input.c renderer.c
+inc = extern.h game.h input.h renderer.h screen.h version.h
+
+.ifdef GPIO
+
+src += gpio.c
+inc += gpio.h
+
+.endif
+
+obj = ${src:.c=.o}
+
+PREFIX = /usr/local
+
+CFLAGS = -O3 -march=native -pipe -flto=thin -Wall -Wno-unused-result
+LDFLAGS = -Wl,-O3 -lpthread -lSDL2 -lSDL2_ttf
+
+.ifdef SOUND
+
+LDFLAGS += -lSDL2_mixer
+
+.endif
+
+LDFLAGS += -Wl,--as-needed
+
+CFLAGS += -I/usr/local/include
+LDFLAGS += -L/usr/local/lib
+
+all: ${obj} ${inc}
+ ${CC} ${LDFLAGS} -o snake ${obj}
+
+clean:
+ rm -f snake ${obj}
+
+install:
+ install -d ${PREFIX}/bin
+ install -d ${PREFIX}/share/snake
+ install snake ${PREFIX}/bin
+ install -m644 ../contrib/font.ttf ${PREFIX}/share/snake
+ install -m644 ../contrib/music.flac ${PREFIX}/share/snake
+
+deinstall:
+ rm -f ${PREFIX}/bin/snake
+ rm -rf ${PREFIX}/share/snake
+
+.PHONY: all clean install deinstall