libnethack pr385
roll parts of pr385 into source tree
This does not take the PR as is.
Unlike the PR, this streamlines and minimizes the integration somewhat:
- use hints/include mechanism instead of creating alternative
Makefile.dat, Makefile.src, Makefile.top, Makefile.utl in sys/lib;
those would have been a maintenance nightmare.
- don't have alternative mkmkfile.sh and setup.sh in sys/lib.
- sys/lib/libnethackmain.c differed from sys/unix/unixmain.c by
very little, so just place a small bit of conditional code at the
top of sys/unix/unixmain.c instead.
- changed the conditional code bits from __EMSCRIPTEN__ to
CROSS_TO_WASM.
- You should be able to build the wasm result by:
cd sys/unix ; sh setup.sh hints/linux.2020 ; cd ../..
make fetch-lua (<-one time)
make WANT_LIBNH all
- You should be able to build LIBNBH by:
cd sys/unix ; sh setup.sh hints/linux.2020 ; cd ../..
make fetch-lua (<-one time)
make CROSS_TO_WASM=1 all
As it is currently coded, winshim.c requires C99.
This commit is contained in:
@@ -18,9 +18,9 @@ $(TARGETPFX)vidvesa.o : ../sys/msdos/vidvesa.c ../sys/msdos/portio.h \
|
||||
$(TARGETPFX)vidstub.o : ../sys/msdos/vidvesa.c ../sys/msdos/portio.h \
|
||||
$(HACK_H)
|
||||
$(TARGETPFX)tile.o : tile.c
|
||||
$(GAMEBIN) : $(HOBJ)
|
||||
$(GAMEBIN) : $(HOBJ) $(LUACROSSLIB)
|
||||
$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
|
||||
$(HOBJ) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
|
||||
$(HOBJ) $(WINLIB) $(TARGET_LIBS)
|
||||
#
|
||||
.PHONY: dospkg
|
||||
dospkg: $(GAMEBIN) $(TARGETPFX)recover.exe ../dat/nhtiles.bmp
|
||||
@@ -81,9 +81,9 @@ $(TARGETPFX)monsters.iff: ../win/share/monsters.txt ../util/txt2iff
|
||||
../util/txt2iff ../win/share/monsters.txt $@
|
||||
$(TARGETPFX)other.iff: ../win/share/other.txt ../util/txt2iff
|
||||
../util/txt2iff ../win/share/other.txt $@
|
||||
$(GAMEBIN) : $(HOBJ)
|
||||
$(GAMEBIN) : $(HOBJ) $(LUACROSSLIB)
|
||||
$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
|
||||
$(HOBJ) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
|
||||
$(HOBJ) $(WINLIB) $(TARGET_LIBS)
|
||||
#
|
||||
.PHONY: amigapkg
|
||||
amigapkg: $(GAMEBIN) $(TARGETPFX)recover.exe ../dat/nhtiles.bmp
|
||||
@@ -119,6 +119,34 @@ amigapkg: $(GAMEBIN) $(TARGETPFX)recover.exe ../dat/nhtiles.bmp
|
||||
@echo amiga package zip file $(TARGETPFX)NH370AMI.ZIP
|
||||
endif # CROSS_TO_AMIGA
|
||||
|
||||
ifdef CROSS_TO_WASM
|
||||
$(WASM_TARGET): $(HOBJ) $(LUACROSSLIB) Makefile $(WASM_DATA_DIR)
|
||||
-rm $@
|
||||
$(TARGET_CC) $(EMCC_LFLAGS) $(EMCC_CFLAGS) -o $@ \
|
||||
$(HOBJ) $(TARGET_LIBS)
|
||||
|
||||
$(WASM_DATA_DIR):
|
||||
-mkdir -p $(WASM_DATA_DIR)
|
||||
touch $(WASM_DATA_DIR)/perm
|
||||
touch $(WASM_DATA_DIR)/record
|
||||
touch $(WASM_DATA_DIR)/logfile
|
||||
touch $(WASM_DATA_DIR)/xlogfile
|
||||
( cd ..; $(MAKE) dlb )
|
||||
( cd ..; $(MAKE) dofiles-dlb )
|
||||
cp ../sys/lib/sysconf $(WASM_DATA_DIR)/sysconf
|
||||
#
|
||||
.PHONY: wasmpkg
|
||||
wasmpkg:
|
||||
@echo "$(WASM_TARGET) done."
|
||||
$(TARGETPFX)unixmain.o : ../sys/unix/unixmain.c $(HACK_H)
|
||||
$(TARGETPFX)unixres.o : ../sys/unix/unixres.c $(HACK_H)
|
||||
$(TARGETPFX)unixunix.o : ../sys/unix/unixunix.c $(HACK_H)
|
||||
$(TARGETPFX)ioctl.o : ../sys/share/ioctl.c $(HACK_H)
|
||||
$(TARGETPFX)unixtty.o : ../sys/share/unixtty.c $(HACK_H)
|
||||
$(TARGETPFX)winshim.o : ../win/shim/winshim.c $(HACK_H)
|
||||
endif # CROSS_TO_WASM
|
||||
#
|
||||
|
||||
ifdef CROSS_SHARED
|
||||
# shared file dependencies
|
||||
$(TARGETPFX)pcmain.o : ../sys/share/pcmain.c $(HACK_H)
|
||||
@@ -141,12 +169,9 @@ $(LUACROSSLIB): $(LUALIBOBJS)
|
||||
$(TARGET_AR) rcS $@ $(LUAOBJFILES2)
|
||||
$(TARGET_AR) rcS $@ $(LUAOBJFILES3)
|
||||
$(TARGET_AR) rcs $@ $(LUAOBJFILES4)
|
||||
ifdef WANT_WIN_CURSES
|
||||
$(TARGETPFX)pdclib.a : $(PDCLIBOBJS) $(PDCOBJS)
|
||||
if [ -f $@ ]; then rm $@; fi;
|
||||
$(TARGET_AR) rcs $@ $(PDCLIBOBJS) $(PDCOBJS)
|
||||
endif
|
||||
#
|
||||
|
||||
# $(TARGET_AR) rcs $@ $(LUALIBOBJS)
|
||||
|
||||
# Lua src
|
||||
$(TARGETPFX)lapi.o : $(LUATOP)/src/lapi.c
|
||||
$(TARGETPFX)lauxlib.o : $(LUATOP)/src/lauxlib.c
|
||||
@@ -184,6 +209,11 @@ $(TARGETPFX)lzio.o : $(LUATOP)/src/lzio.c
|
||||
endif # BUILD_LUA
|
||||
|
||||
ifdef BUILD_PDCURSES
|
||||
ifdef WANT_WIN_CURSES
|
||||
$(TARGETPFX)pdclib.a : $(PDCLIBOBJS) $(PDCOBJS)
|
||||
if [ -f $@ ]; then rm $@; fi;
|
||||
$(TARGET_AR) rcs $@ $(PDCLIBOBJS) $(PDCOBJS)
|
||||
endif
|
||||
# PDCurses src
|
||||
$(TARGETPFX)addch.o : $(PDCTOP)/pdcurses/addch.c
|
||||
$(TARGETPFX)addchstr.o : $(PDCTOP)/pdcurses/addchstr.c
|
||||
|
||||
Reference in New Issue
Block a user