diff options
author | boredpasta <boredpasta@tutanota.com> | 2025-01-15 01:26:49 +0200 |
---|---|---|
committer | boredpasta <boredpasta@tutanota.com> | 2025-01-15 01:27:05 +0200 |
commit | b22b2f7551eb0b04cc1317f3df7050dfb1ee8efd (patch) | |
tree | 8cd7793d1ff600d8b67bd48dceec6061d06d989a | |
parent | b7ac144cd2d242791938b51569effb7a1378a332 (diff) |
Replace build script with a makefile
-rw-r--r-- | Makefile | 48 | ||||
-rwxr-xr-x | build | 7 |
2 files changed, 48 insertions, 7 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c0fb54c --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +.POSIX: +.SUFFIXES: + +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/man + +CFLAGS = -std=c99 -Wall -Wextra -Wpedantic -pedantic-errors +CFLAGS_DEBUG = -g3 -O0 +LDLIBS = -lm -lncurses + +SRC = fun_menu.c cycle.c richwin.c stack.c utils.c +OBJ = ${SRC:.c=.o} +OBJ_DEBUG = ${SRC:.c=.odebug} + +all: fun_menu + +fun_menu: ${OBJ} + ${CC} ${LDFLAGS} -o $@ ${CFLAGS} ${OBJ} ${LDLIBS} + +debug: ${OBJ_DEBUG} + ${CC} ${LDFLAGS} -o fun_menu.debug ${CFLAGS} ${CFLAGS_DEBUG} ${OBJ_DEBUG} \ + ${LDLIBS} + +.SUFFIXES: .c .o .odebug +.c.o: + ${CC} -c ${CFLAGS} $< +.c.odebug: + ${CC} -c -o ${<:.c=.odebug} ${CFLAGS} ${DEBUG} $< + +deps: + # TODO + +install: all + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f fun_menu ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/fun_menu + cp fun_menu.1 ${DESTDIR}${MANPREFIX}/man1 + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + chmod 644 ${DESTDIR}${MANPREFIX}/man1/fun_menu.1.gz + +uninstall: + rm -f ${DESTDIR}${PREFIX}/bin/fun_menu\ + ${DESTDIR}${MANPREFIX}/man1/dwm.1 + +clean: + rm -fr fun_menu fun_menu.debug ${OBJ} ${OBJ_DEBUG} + +.PHONY: all install uninstall debug clean @@ -1,7 +0,0 @@ -#!/bin/sh -e -options="" -options="${options} -g3 -O0" -options="${options} -Weverything -Wno-declaration-after-statement -Wno-padded -Wno-disabled-macro-expansion" -options="${options} -std=c99 -Wpedantic -pedantic-errors" -options="${options} $(pkg-config --cflags --libs ncurses)" -clang $options -lm -o fun_menu fun_menu.c utils.c richwin.c stack.c cycle.c |