diff options
| author | Mattias Andrée <maandree@kth.se> | 2021-04-22 20:49:48 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2021-04-22 20:51:38 +0200 |
| commit | 77e516665f23b9cb7af864318c61582d91ab5870 (patch) | |
| tree | 50772907d8d9ce249e47e034455489e22185ac98 /Makefile | |
| download | basic-games-77e516665f23b9cb7af864318c61582d91ab5870.tar.gz basic-games-77e516665f23b9cb7af864318c61582d91ab5870.tar.bz2 basic-games-77e516665f23b9cb7af864318c61582d91ab5870.tar.xz | |
First commit, with implementation of tic-tac-toe
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..60fb777 --- /dev/null +++ b/Makefile @@ -0,0 +1,64 @@ +.POSIX: + +CONFIGFILE = config.mk + +CALLTYPE = multicall-hardlinks +# multicall-hardlinks = multiple hardlinks of the same multicall binary is installed +# multicall-symlinks = multiple links to a multicall binary named $(PREFIX)/bin/basic-games are installed +# singlecall = separate binaries are install for each command + + +BIN =\ + tic-tac-toe + +HDR =\ + common.h + +COMMON = + +OBJ = $(BIN:=.o) $(COMMON) +BOBJ = $(OBJ:.o=.bo) +MAN1 = $(BIN:=.1) + + +include $(CONFIGFILE) +include $(CALLTYPE).mk + + +$(OBJ): $(@:.o=.c) $(HDR) +$(BOBJ): $(@:.bo=.c) $(HDR) + +.c.o: + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) + +.c.bo: + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) -Dmain="$$(printf '%s\n' main__$* | tr - _)" -DMULTICALL_BINARY + +basic-games: basic-games.o $(BOBJ) + $(CC) -o $@ $@.o $(BOBJ) $(LDFLAGS) + +basic-games.c: basic-games.c.in Makefile + printf '#define LIST_COMMANDS' > $@ + printf '\\\n\tX(%s)' $(BIN) | tr - _ >> $@ + printf '\n\n' >> $@ + cat basic-games.c.in >> $@ + +tic-tac-toe: tic-tac-toe.o + $(CC) -o $@ $@.o $(LDFLAGS) + +install-common: + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1" + cp -- $(MAN1) "$(DESTDIR)$(MANPREFIX)/man1" + +uninstall: + -cd -- "$(DESTDIR)$(PREFIX)/bin" && rm -f -- $(BIN_) + -cd -- "$(DESTDIR)$(MANPREFIX)/man1" && rm -f -- $(MAN1) + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/basic-games" + +clean: + -rm -rf -- *.o *.a *.lo *.so *.bo *.su $(BIN) basic-games basic-games.c + +.SUFFIXES: +.SUFFIXES: .o .c .bo + +.PHONY: all install install-common uninstall clean |
