| 1 |
# -*- Makefile -*- |
| 2 |
|
| 3 |
#-O3 --std=c99 -lcurses -DNO_MOUSE for NetBSD curses |
| 4 |
#adding --std=c99 makes warnings in GNU, and the blame is upon glibc feature test macros. my code is correct. |
| 5 |
GAMES_DIR?=$(PREFIX)/usr/bin |
| 6 |
SCORES_DIR?=$(PREFIX)/var/games |
| 7 |
MAN_DIR?=$(PREFIX)/usr/share/man/man6 |
| 8 |
CFLAGS+= -Wno-unused-result -DSCORES_DIR=\"$(SCORES_DIR)\" |
| 9 |
LIBS_PKG_CONFIG!=pkg-config --libs --cflags ncurses |
| 10 |
LIBS=$(LIBS_PKG_CONFIG) -lm |
| 11 |
|
| 12 |
|
| 13 |
ALL= nbsdgames jewels sudoku mines reversi checkers battleship rabbithole sos pipes fifteen memoblocks fisher muncher miketron redsquare darrt snakeduel tugow revenge trsr sjump scissor |
| 14 |
SCORE_FILES= pipes_scores jewels_scores miketron_scores muncher_scores fisher_scores darrt_scores tugow_scores revenge_scores sjump_scores redsquare_scores scissor_scores |
| 15 |
SRC!=echo *.c *.h |
| 16 |
all: $(ALL) |
| 17 |
|
| 18 |
scorefiles: |
| 19 |
for sf in $(SCORE_FILES); do touch $(DESTDIR)$(SCORES_DIR)/$$sf ; chmod 664 $(DESTDIR)$(SCORES_DIR)/$$sf; chown :games $(DESTDIR)$(SCORES_DIR)/$$sf ; done; |
| 20 |
for game in $(ALL); do chown :games $(DESTDIR)$(GAMES_DIR)/$$game; chmod g $(DESTDIR)$(GAMES_DIR)/$$game ; done; |
| 21 |
|
| 22 |
manpages: |
| 23 |
cp man/* $(DESTDIR)$(MAN_DIR) |
| 24 |
|
| 25 |
$(ALL): $(SRC) config.h common.h |
| 26 |
$(CC) $(CFLAGS) [email protected] $(LDFLAGS) $(LIBS) -o $@ |
| 27 |
|
| 28 |
menu: |
| 29 |
cp nbsdgames.desktop $(DESTIDR)$(PREFIX)/usr/share/applications |
| 30 |
cp nbsdgames.svg $(DESTDIR)$(PREFIX)/usr/share/pixmaps |
| 31 |
clean: |
| 32 |
for game in $(ALL); do rm $$game; done; |
| 33 |
uninstall: |
| 34 |
for game in $(ALL); do rm $(GAMES_DIR)/$$game; rm $(MAN_DIR)/$$game.6.gz ;done; |
| 35 |
install: $(ALL) |
| 36 |
cp $(ALL) $(DESTDIR)/$(GAMES_DIR) |
| 37 |
test: |
| 38 |
for game in $(ALL); do ./$$game ;done; |
| 39 |
|
| 40 |
#######for namespacing ####### |
| 41 |
nb: |
| 42 |
CFLAGS="$$CFLAGS -D NB=\\\"nb\\\"" $(MAKE) |
| 43 |
for game in $(ALL); do cp $$game nb$$game ;done; |
| 44 |
for manpage in $(ls man); do cp man/$$manpage man/nb$$manpage ;done; |
| 45 |
nbinstall: nb |
| 46 |
for game in $(ALL); do cp nb$$game $(DESTDIR)/$(GAMES_DIR) ;done; |
| 47 |
cp nbsdgames $(DESTDIR)/$(GAMES_DIR) |
| 48 |
rm $(DESTDIR)/$(GAMES_DIR)/nbnbsdgames |
| 49 |
nbmanpages: nb |
| 50 |
cp man/nb* $(DESTDIR)/$(MAN_DIR) |
| 51 |
nbclean: clean |
| 52 |
for game in $(ALL); do rm nb$$game ;done; |
| 53 |
|