2019-03-20 10:16:33 -04:00
# -*- Makefile -*-
2021-04-23 16:55:17 -04:00
2021-04-20 10:09:41 -04:00
#-O3 --std=c99 -lcurses -DNO_MOUSE for NetBSD curses
#adding --std=c99 makes warnings in GNU, and the blame is upon glibc feature test macros. my code is correct.
2022-04-06 10:41:18 -04:00
GAMES_DIR ?= $( PREFIX) /usr/bin
SCORES_DIR ?= $( PREFIX) /var/games
MAN_DIR ?= $( PREFIX) /usr/share/man/man6
CFLAGS += -Wno-unused-result -DSCORES_DIR= \" $( SCORES_DIR) \"
2022-03-30 23:48:05 -04:00
LIBS_PKG_CONFIG != pkg-config --libs --cflags ncurses
LIBS = $( LIBS_PKG_CONFIG) -lm
2021-04-29 19:05:16 -04:00
2022-11-16 09:05:20 -05:00
ALL = nbsdgames jewels sudoku mines reversi checkers battleship rabbithole sos pipes fifteen memoblocks fisher muncher miketron redsquare darrt snakeduel tugow revenge trsr sjump
SCORE_FILES = pipes_scores jewels_scores miketron_scores muncher_scores fisher_scores darrt_scores tugow_scores revenge_scores sjump_scores
2022-08-04 03:49:46 -04:00
SRC != echo *.c *.h
2022-03-30 23:00:41 -04:00
all : $( ALL )
2021-04-29 19:05:16 -04:00
2020-06-20 12:26:54 -04:00
scorefiles :
2022-04-06 10:41:18 -04:00
for sf in $( SCORE_FILES) ; do touch $( DESTDIR) $( SCORES_DIR) /$$ sf ; chmod 664 $( DESTDIR) $( SCORES_DIR) /$$ sf; chown :games $( DESTDIR) $( SCORES_DIR) /$$ sf ; done ;
for game in $( ALL) ; do chown :games $( DESTDIR) $( GAMES_DIR) /$$ game; chmod g $( DESTDIR) $( GAMES_DIR) /$$ game ; done ;
2021-04-29 19:05:16 -04:00
2021-05-03 18:03:52 -04:00
manpages :
2022-04-06 10:41:18 -04:00
cp man/* $( DESTDIR) $( MAN_DIR)
2022-03-30 23:45:14 -04:00
2022-08-04 03:49:46 -04:00
$(ALL) : $( SRC ) config .h common .h
$( CC) $( CFLAGS) $@ .c $( LDFLAGS) $( LIBS) -o $@
2022-03-30 23:45:14 -04:00
2022-02-01 17:25:05 -05:00
menu :
2022-03-30 23:13:38 -04:00
cp nbsdgames.desktop $( DESTIDR) $( PREFIX) /usr/share/applications
cp nbsdgames.svg $( DESTDIR) $( PREFIX) /usr/share/pixmaps
2019-03-20 10:16:33 -04:00
clean :
2021-08-06 02:27:54 -04:00
for game in $( ALL) ; do rm $$ game; done ;
2019-03-20 10:16:33 -04:00
uninstall :
2022-04-06 10:41:18 -04:00
for game in $( ALL) ; do rm $( GAMES_DIR) /$$ game; rm $( MAN_DIR) /$$ game.6.gz ; done ;
2021-04-29 19:05:16 -04:00
install : $( ALL )
2022-04-06 10:41:18 -04:00
cp $( ALL) $( DESTDIR) /$( GAMES_DIR)
2021-08-20 08:40:45 -04:00
test :
for game in $( ALL) ; do ./$$ game ; done ;
2021-08-06 02:27:54 -04:00
#######for namespacing #######
2022-02-01 17:25:05 -05:00
nb :
2022-03-30 23:14:34 -04:00
CFLAGS = " $$ CFLAGS -D NB=\\\"nb\\\" " $( MAKE)
2022-02-01 17:25:05 -05:00
for game in $( ALL) ; do cp $$ game nb$$ game ; done ;
for manpage in $( ls man) ; do cp man/$$ manpage man/nb$$ manpage ; done ;
2021-08-06 02:27:54 -04:00
nbinstall : nb
2022-04-10 02:33:18 -04:00
for game in $( ALL) ; do cp nb$$ game $( DESTDIR) /$( GAMES_DIR) ; done ;
2022-04-14 02:57:23 -04:00
cp nbsdgames $( DESTDIR) /$( GAMES_DIR)
2022-04-15 00:26:34 -04:00
rm $( DESTDIR) /$( GAMES_DIR) /nbnbsdgames
2021-08-06 02:27:54 -04:00
nbmanpages : nb
2022-04-06 10:41:18 -04:00
cp man/nb* $( DESTDIR) /$( MAN_DIR)
2022-04-10 02:33:18 -04:00
nbclean : clean
for game in $( ALL) ; do rm nb$$ game ; done ;