diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-02-17 14:05:02 -0500 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-02-22 09:20:17 -0500 |
commit | 08eca96e71d96ad1f8e9b888875ab5570f208d19 (patch) | |
tree | 9cace520fa50d9ef5bb77c2d7ebdde40e6b40f7f /tetris | |
parent | 3f650c87c6ee6692ad6a558bb03ccf3364fe794a (diff) | |
download | bsdgames-darwin-08eca96e71d96ad1f8e9b888875ab5570f208d19.tar.gz bsdgames-darwin-08eca96e71d96ad1f8e9b888875ab5570f208d19.tar.zst bsdgames-darwin-08eca96e71d96ad1f8e9b888875ab5570f208d19.zip |
Get all the games compiling for iOS
Diffstat (limited to 'tetris')
-rw-r--r-- | tetris/Makefile | 21 | ||||
-rw-r--r-- | tetris/input.c | 2 | ||||
-rw-r--r-- | tetris/scores.c | 12 | ||||
-rw-r--r-- | tetris/screen.c | 2 |
4 files changed, 25 insertions, 12 deletions
diff --git a/tetris/Makefile b/tetris/Makefile index 43112240..aeda79a9 100644 --- a/tetris/Makefile +++ b/tetris/Makefile @@ -4,12 +4,19 @@ PROG= tetris SRCS= input.c screen.c shapes.c scores.c tetris.c MAN= tetris.6 -DPADD= ${LIBTERMINFO} -LDADD= -lterminfo -HIDEGAME=hidegame -SETGIDGAME=yes -COPTS.tetris.c+= ${GCC_NO_FORMAT_TRUNCATION} -COPTS.scores.c+= ${GCC_NO_FORMAT_TRUNCATION} +all: $(PROG) -.include <bsd.prog.mk> +$(PROG): $(SRCS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(SRCS) -lncursesw + $(STRIP) $(PROG) + +install: $(PROG) $(MAN) + $(GINSTALL) -Dm2755 $(PROG) $(DESTDIR)/usr/games/$(PROG) + $(GINSTALL) -Dm644 $(MAN) $(DESTDIR)/usr/share/man/man6/$(MAN) + $(GINSTALL) -d $(DESTDIR)/var/games + +clean: + rm -f $(CLEANFILES) $(PROG) + +.PHONY: all clean install diff --git a/tetris/input.c b/tetris/input.c index e5f8c12a..65741e5c 100644 --- a/tetris/input.c +++ b/tetris/input.c @@ -48,6 +48,8 @@ #include "input.h" #include "tetris.h" +#define INFTIM (-1) + /* return true iff the given timeval is positive */ #define TV_POS(tv) \ ((tv)->tv_sec > 0 || ((tv)->tv_sec == 0 && (tv)->tv_usec > 0)) diff --git a/tetris/scores.c b/tetris/scores.c index 1335df7b..dc791612 100644 --- a/tetris/scores.c +++ b/tetris/scores.c @@ -58,6 +58,8 @@ #include "scores.h" #include "tetris.h" +#include <libkern/OSByteOrder.h> + /* * Allow updating the high scores unless we're built as part of /rescue. */ @@ -220,9 +222,9 @@ scorefile_probe(int sd) } /* None was a valid level; try opposite endian */ - offset64 = bswap32(offset64); - offset60 = bswap32(offset60); - offset56 = bswap32(offset56); + offset64 = OSSwapInt32(offset64); + offset60 = OSSwapInt32(offset60); + offset56 = OSSwapInt32(offset56); if (offset64 >= MINLEVEL && offset64 <= MAXLEVEL) { /* 40-byte structure */ @@ -267,7 +269,7 @@ static int32_t read32(int32_t val, int doflip) { if (doflip) { - val = bswap32(val); + val = OSSwapInt32(val); } return val; } @@ -276,7 +278,7 @@ static int64_t read64(int64_t val, int doflip) { if (doflip) { - val = bswap64(val); + val = OSSwapInt64(val); } return val; } diff --git a/tetris/screen.c b/tetris/screen.c index bc065aaa..d723b54e 100644 --- a/tetris/screen.c +++ b/tetris/screen.c @@ -50,6 +50,8 @@ #include <termios.h> #include <unistd.h> +#include <termcap.h> + #ifndef sigmask #define sigmask(s) (1 << ((s) - 1)) #endif |