Qt 5 vs Qt 6 revisited plus 'make depend' update

Rename the recently added timestamp file used to throw away old qt
'moc' files from moc.qt5 or moc.qt6 to Qt5.h-t or Qt6.h-t and use
that to also throw away old qt_*.o when switching from Qt 5 to Qt 6
or vice versa.  Temporarily the old names remain in Makefile.src's
'clean' target and in src/.gitignore but those will be removed soon.

Update 'make depend' to add the timestamp file to qt_*.o dependencies.
Have it generate rules to build qt_*.moc from ../win/Qt/qt_*.h instead
of using a template rule in hints/include/compiler.370.  So building
the Qt interface doesn't require use of that hints file anymore and
someone reading Makefile.src won't have to know about it, but using
those hints will make their life easier.

Simplify the Qt timestamp handling portion of compiler.370.  Only one
extra rule gets added when creating src/Makefile.

src/Makefile generated from sys/unix/Makefile.src that's been rebuilt
with 'make depend' got broken by uncommenting '#include "amiconf.h"'
in global.h.  That file isn't in include/ but every object file now
depended on it and make didn't know what to do about that.  Have
depend.awk treat it as a special case so that no object files depend
on it.  That means that actually modifying it won't trigger a rebuild;
anyone fiddling with that will have to always do 'make clean' or
'touch config.h-t' after changing it.  The alternative is to move it
from outdated/include/ back to include/.

In depend.awk, recent gawk complained that "\." wasn't a defined
escape sequence in regular expressions so it would be treated as ".".
That's exactly what is intended but change it to "[.]" to avoid the
warning.  Similarly for one instance each of "\#" and '\"'.  I also
tried changing "\/" to "[/]" even though that is a defined sequence
and doesn't trigger any warning.  gawk accepted it but the awk that
comes with OSX choked on it so I changed it back to "\/".
This commit is contained in:
PatR
2022-02-05 04:15:51 -08:00
parent 20054551f9
commit f9f209bb49
4 changed files with 127 additions and 87 deletions

6
src/.gitignore vendored
View File

@@ -1,9 +1,15 @@
config.h-t
hack.h-t
Qt*.h-t
monstr.c
vis_tab.c
tile.c
Sysunix
Sys3B2
Sysatt
SysV-AT
Systos
SysBe
nethack
*.o
tiles.bmp

View File

@@ -181,6 +181,9 @@ CXX ?= g++
MOC ?= moc
MOCPATH ?= $(QTDIR)/bin/$(MOC)
#LINK=g++
# included for documentation purposes if not using the relevant hints files;
# when not using those to manage the value, it should remain empty
#QTn_H =
# The default is for the TARGET_* variables to match the defaults.
# If we're cross-compiling these will get overridden elsewhere, likely via
@@ -235,7 +238,7 @@ WINX11OBJ = $(TARGETPFX)Window.o $(TARGETPFX)dialogs.o $(TARGETPFX)winX.o \
$(TARGETPFX)winmisc.o $(TARGETPFX)winstat.o $(TARGETPFX)wintext.o \
$(TARGETPFX)winval.o $(TARGETPFX)tile.o
#
# Files for a Qt 3 port (renamed since nethack 3.6.x)
# Files for a Qt 3 interface (renamed since nethack 3.6.x)
#
#WINQT3SRC = ../win/Qt3/qt3_win.cpp ../win/Qt3/qt3_clust.cpp \
# ../win/Qt3/qt3tableview.cpp
@@ -246,8 +249,12 @@ WINQT3SRC =
WINQT3OBJ =
#
# Files for a Qt 4 or 5 port
# Files for a Qt 4, Qt 5, or Qt 6 interface
#
# generated source files made by Qt's 'moc' program from ../win/Qt/qt_*.h;
# appended to WINQTSRC for use by 'make depend'
WINQTMOC = qt_kde0.moc qt_main.moc qt_map.moc qt_menu.moc qt_msg.moc \
qt_plsel.moc qt_set.moc qt_stat.moc qt_xcmd.moc qt_yndlg.moc
WINQTSRC = ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \
../win/Qt/qt_clust.cpp ../win/Qt/qt_delay.cpp \
../win/Qt/qt_glyph.cpp ../win/Qt/qt_icon.cpp ../win/Qt/qt_inv.cpp \
@@ -256,7 +263,7 @@ WINQTSRC = ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \
../win/Qt/qt_plsel.cpp ../win/Qt/qt_rip.cpp ../win/Qt/qt_set.cpp \
../win/Qt/qt_stat.cpp ../win/Qt/qt_str.cpp ../win/Qt/qt_streq.cpp \
../win/Qt/qt_svsel.cpp ../win/Qt/qt_win.cpp ../win/Qt/qt_xcmd.cpp \
../win/Qt/qt_yndlg.cpp
../win/Qt/qt_yndlg.cpp $(WINQTMOC)
WINQTOBJ = $(TARGETPFX)qt_bind.o $(TARGETPFX)qt_click.o \
$(TARGETPFX)qt_clust.o $(TARGETPFX)qt_delay.o \
$(TARGETPFX)qt_glyph.o $(TARGETPFX)qt_icon.o \
@@ -609,8 +616,8 @@ Sys3B2: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
Sysatt: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Loading $(GAME)."
$(AT)$(LD) $(TARGET_LFLAGS) /lib/crt0s.o /lib/shlib.ifile -o $(GAMEBIN) \
$(HOSTOBJ) $(HOBJ) $(DATE_O) $(LUALIB)
$(AT)$(LD) $(TARGET_LFLAGS) /lib/crt0s.o /lib/shlib.ifile \
-o $(GAMEBIN) $(HOSTOBJ) $(HOBJ) $(DATE_O) $(LUALIB)
@touch Sysatt
Systos: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@@ -678,11 +685,6 @@ qt3_win.moc: ../win/Qt3/qt3_win.h
qt3tableview.moc: ../win/Qt3/qt3tableview.h
$(QTDIR)/bin/moc -o qt3tableview.moc ../win/Qt3/qt3tableview.h
# for Qt 5 and 6, template rules to build qt_xyz.moc from corresponding
# ../win/Qt/qt_xyz.h are in sys/unix/hints/compiler.370 and get added
# to src/Makefile if the appropriate hints file gets used with setup.sh;
# so, build support for the Qt interface requires the use of hints...
# build monst.o and objects.o before executing '$(MAKE) makedefs'
$(MAKEDEFS): $(FIRSTOBJ) \
../util/makedefs.c ../src/mdlib.c $(CONFIG_H) \
@@ -696,11 +698,6 @@ $(MAKEDEFS): $(FIRSTOBJ) \
# Source files formerly created by 'makedefs' at build time
# but no longer used.
# Each is given an artificial dependency upon the one before
# so that parallel makes will have to build them sequentially.
# (More for documentation than effect; 'make' should know not
# to try to build $(MAKEDEFS) for bar.h while it is in the
# process of building it for foo.h.)
../include/onames.h: $(MAKEDEFS)
@( cd ../util ; $(MAKE) ../include/onames.h )
../include/pm.h: $(MAKEDEFS)
@@ -749,7 +746,7 @@ tags: $(CSOURCES)
@( cd ../util ; $(MAKE) tags )
clean:
-rm -f *.o $(HACK_H) $(CONFIG_H)
-rm -f *.o $(HACK_H) $(CONFIG_H) moc.qt*
-rm -f monstr.c vis_tab.c ../include/vis_tab.h #obsolete generated files
$(CLEANMORE)
@@ -758,7 +755,7 @@ spotless: clean
-rm -f ../include/nhlua.h
-rm -f ../include/date.h #created but no longer used, at least by core
-rm -f ../include/onames.h ../include/pm.h #obsolete generated files
-rm -f tile.c *.moc moc.qt*
-rm -f tile.c *.moc Qt*.h-t
-rm -f ../win/gnome/gn_rip.h
package:
@@ -803,12 +800,12 @@ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \
../include/monsters.h ../include/mondata.h \
../include/wintype.h ../include/context.h ../include/rm.h \
../include/botl.h ../include/rect.h ../include/region.h \
../include/display.h ../include/vision.h ../include/color.h \
../include/decl.h ../include/quest.h ../include/spell.h \
../include/color.h ../include/obj.h ../include/engrave.h \
../include/you.h ../include/attrib.h ../include/monst.h \
../include/mextra.h ../include/skills.h ../include/timeout.h \
../include/trap.h ../include/flag.h ../include/vision.h \
../include/display.h ../include/winprocs.h ../include/sys.h
../include/obj.h ../include/engrave.h ../include/you.h \
../include/attrib.h ../include/monst.h ../include/mextra.h \
../include/skills.h ../include/timeout.h ../include/trap.h \
../include/flag.h ../include/winprocs.h ../include/sys.h
touch $(HACK_H)
#
$(TARGETPFX)pcmain.o: ../sys/share/pcmain.c $(HACK_H) ../include/dlb.h
@@ -915,35 +912,37 @@ $(TARGETPFX)qt_bind.o: ../win/Qt/qt_bind.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_rip.h ../win/Qt/qt_msg.h ../win/Qt/qt_plsel.h \
../win/Qt/qt_svsel.h ../win/Qt/qt_set.h ../win/Qt/qt_stat.h \
../win/Qt/qt_icon.h ../win/Qt/qt_streq.h ../win/Qt/qt_line.h \
../win/Qt/qt_yndlg.h ../win/Qt/qt_str.h ../include/dlb.h
../win/Qt/qt_yndlg.h ../win/Qt/qt_str.h ../include/dlb.h \
$(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_bind.cpp
$(TARGETPFX)qt_click.o: ../win/Qt/qt_click.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_click.h
../win/Qt/qt_post.h ../win/Qt/qt_click.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_click.cpp
$(TARGETPFX)qt_clust.o: ../win/Qt/qt_clust.cpp ../win/Qt/qt_clust.h
$(TARGETPFX)qt_clust.o: ../win/Qt/qt_clust.cpp ../win/Qt/qt_clust.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_clust.cpp
$(TARGETPFX)qt_delay.o: ../win/Qt/qt_delay.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_delay.h
../win/Qt/qt_post.h ../win/Qt/qt_delay.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_delay.cpp
$(TARGETPFX)qt_glyph.o: ../win/Qt/qt_glyph.cpp $(HACK_H) ../include/tile2x11.h \
../win/Qt/qt_pre.h ../win/Qt/qt_post.h ../win/Qt/qt_glyph.h \
../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
../win/Qt/qt_set.h ../win/Qt/qt_inv.h ../win/Qt/qt_map.h \
../win/Qt/qt_win.h ../win/Qt/qt_clust.h ../win/Qt/qt_str.h
$(TARGETPFX)qt_glyph.o: ../win/Qt/qt_glyph.cpp $(HACK_H) \
../include/tile2x11.h ../win/Qt/qt_pre.h ../win/Qt/qt_post.h \
../win/Qt/qt_glyph.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
../win/Qt/qt_kde0.h ../win/Qt/qt_set.h ../win/Qt/qt_inv.h \
../win/Qt/qt_map.h ../win/Qt/qt_win.h ../win/Qt/qt_clust.h \
../win/Qt/qt_str.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_glyph.cpp
$(TARGETPFX)qt_icon.o: ../win/Qt/qt_icon.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_icon.h
../win/Qt/qt_post.h ../win/Qt/qt_icon.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_icon.cpp
$(TARGETPFX)qt_inv.o: ../win/Qt/qt_inv.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_inv.h ../win/Qt/qt_glyph.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h \
../win/Qt/qt_bind.h
../win/Qt/qt_bind.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_inv.cpp
$(TARGETPFX)qt_key.o: ../win/Qt/qt_key.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_key.h
../win/Qt/qt_post.h ../win/Qt/qt_key.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_key.cpp
$(TARGETPFX)qt_line.o: ../win/Qt/qt_line.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_line.h
../win/Qt/qt_post.h ../win/Qt/qt_line.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_line.cpp
$(TARGETPFX)qt_main.o: ../win/Qt/qt_main.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
@@ -951,57 +950,62 @@ $(TARGETPFX)qt_main.o: ../win/Qt/qt_main.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_inv.h ../win/Qt/qt_key.h ../win/Qt/qt_map.h \
../win/Qt/qt_win.h ../win/Qt/qt_clust.h ../win/Qt/qt_msg.h \
../win/Qt/qt_set.h ../win/Qt/qt_stat.h ../win/Qt/qt_icon.h \
../win/Qt/qt_str.h qt_kde0.moc
../win/Qt/qt_str.h qt_kde0.moc $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_main.cpp
$(TARGETPFX)qt_map.o: ../win/Qt/qt_map.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_map.h ../win/Qt/qt_win.h \
../win/Qt/qt_clust.h qt_map.moc ../win/Qt/qt_click.h \
../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h \
$(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_map.cpp
$(TARGETPFX)qt_menu.o: ../win/Qt/qt_menu.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_menu.h ../win/Qt/qt_win.h \
../win/Qt/qt_rip.h qt_menu.moc ../win/Qt/qt_key.h \
../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_streq.h \
../win/Qt/qt_line.h ../win/Qt/qt_str.h
../win/Qt/qt_line.h ../win/Qt/qt_str.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_menu.cpp
$(TARGETPFX)qt_msg.o: ../win/Qt/qt_msg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_msg.h ../win/Qt/qt_win.h \
qt_msg.moc ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \
../win/Qt/qt_set.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
../win/Qt/qt_kde0.h ../win/Qt/qt_str.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_msg.cpp
$(TARGETPFX)qt_plsel.o: ../win/Qt/qt_plsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_plsel.h qt_plsel.moc \
../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h
../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h \
$(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_plsel.cpp
$(TARGETPFX)qt_rip.o: ../win/Qt/qt_rip.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_rip.h ../win/Qt/qt_bind.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h \
$(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_rip.cpp
$(TARGETPFX)qt_set.o: ../win/Qt/qt_set.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h qt_set.moc \
../win/Qt/qt_glyph.h ../win/Qt/qt_xcmd.h ../win/Qt/qt_str.h
../win/Qt/qt_glyph.h ../win/Qt/qt_xcmd.h ../win/Qt/qt_str.h \
$(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_set.cpp
$(TARGETPFX)qt_stat.o: ../win/Qt/qt_stat.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_stat.h ../win/Qt/qt_win.h \
../win/Qt/qt_icon.h qt_stat.moc ../win/Qt/qt_set.h \
../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
../win/Qt/qt_str.h ../win/Qt/qt_xpms.h
../win/Qt/qt_str.h ../win/Qt/qt_xpms.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_stat.cpp
$(TARGETPFX)qt_str.o: ../win/Qt/qt_str.cpp ../win/Qt/qt_str.h
$(TARGETPFX)qt_str.o: ../win/Qt/qt_str.cpp ../win/Qt/qt_str.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_str.cpp
$(TARGETPFX)qt_streq.o: ../win/Qt/qt_streq.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_streq.h ../win/Qt/qt_line.h \
../win/Qt/qt_str.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_streq.cpp
$(TARGETPFX)qt_svsel.o: ../win/Qt/qt_svsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_svsel.h ../win/Qt/qt_bind.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h \
$(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_svsel.cpp
$(TARGETPFX)qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_win.h ../win/Qt/qt_bind.h \
@@ -1009,18 +1013,40 @@ $(TARGETPFX)qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_glyph.h ../win/Qt/qt_inv.h ../win/Qt/qt_key.h \
../win/Qt/qt_icon.h ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \
../win/Qt/qt_menu.h ../win/Qt/qt_rip.h ../win/Qt/qt_msg.h \
../win/Qt/qt_set.h
../win/Qt/qt_set.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp
$(TARGETPFX)qt_xcmd.o: ../win/Qt/qt_xcmd.cpp $(HACK_H) ../include/func_tab.h \
../win/Qt/qt_pre.h ../win/Qt/qt_post.h ../win/Qt/qt_xcmd.h \
qt_xcmd.moc ../win/Qt/qt_key.h ../win/Qt/qt_bind.h \
../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h \
../win/Qt/qt_str.h
../win/Qt/qt_str.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_xcmd.cpp
$(TARGETPFX)qt_yndlg.o: ../win/Qt/qt_yndlg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
../win/Qt/qt_post.h ../win/Qt/qt_yndlg.h qt_yndlg.moc \
../win/Qt/qt_key.h ../win/Qt/qt_str.h
../win/Qt/qt_key.h ../win/Qt/qt_str.h $(QTn_H)
$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_yndlg.cpp
qt_kde0.moc: ../win/Qt/qt_kde0.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_kde0.h
qt_main.moc: ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_main.h
qt_map.moc: ../win/Qt/qt_map.h ../win/Qt/qt_win.h ../win/Qt/qt_clust.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_map.h
qt_menu.moc: ../win/Qt/qt_menu.h ../win/Qt/qt_win.h ../win/Qt/qt_rip.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_menu.h
qt_msg.moc: ../win/Qt/qt_msg.h ../win/Qt/qt_win.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_msg.h
qt_plsel.moc: ../win/Qt/qt_plsel.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_plsel.h
qt_set.moc: ../win/Qt/qt_set.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
../win/Qt/qt_kde0.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_set.h
qt_stat.moc: ../win/Qt/qt_stat.h ../win/Qt/qt_win.h ../win/Qt/qt_icon.h \
$(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_stat.h
qt_xcmd.moc: ../win/Qt/qt_xcmd.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_xcmd.h
qt_yndlg.moc: ../win/Qt/qt_yndlg.h $(QTn_H)
$(MOCPATH) -o $@ ../win/Qt/qt_yndlg.h
$(TARGETPFX)wc_chainin.o: ../win/chain/wc_chainin.c $(HACK_H)
$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/chain/wc_chainin.c
$(TARGETPFX)wc_chainout.o: ../win/chain/wc_chainout.c $(HACK_H)

View File

@@ -18,6 +18,7 @@
# during development;
# patchlev.h gets special handling because it only exists on systems
# which consider filename patchlevel.h to be too long;
# amiconf.h moved from ../include/ to ../outdated/include/ so skip it
# interp.c gets special handling because it usually doesn't exist; it's
# assumed to be the last #include in the file where it occurs.
# win32api.h gets special handling because it only exists for some ports;
@@ -29,6 +30,7 @@ BEGIN { FS = "\"" #for `#include "X"', $2 is X
special[++sp_cnt] = "../include/hack.h"
alt_deps["../include/extern.h"] = ""
alt_deps["../include/patchlev.h"] = ""
alt_deps["../include/amiconf.h"] = ""
alt_deps["interp.c"] = " #interp.c" #comment it out
alt_deps["../include/win32api.h"] = " #../include/win32api.h"
alt_deps["../include/zlib.h"] = " #zlib.h" #comment it out
@@ -36,29 +38,29 @@ BEGIN { FS = "\"" #for `#include "X"', $2 is X
FNR == 1 { output_dep() #finish previous file
file = FILENAME #setup for current file
}
/^\#[ \t]*include[ \t]+\"/ { #find `#include "X"'
/^[#][ \t]*include[ \t]+["]/ { #find `#include "X"'
incl = $2
#[3.4.0: gnomehack headers currently aren't in include]
#[3.6.2: Qt4 headers aren't in include either]
#[3.6.2: curses headers likewise]
#[3.7.0: Qt headers have moved]
if (incl ~ /\.h$/) {
if (incl ~ "curses\.h")
#[3.7.0: Qt headers have moved; process 'moc' files]
if (incl ~ /[.]h$/) {
if (incl ~ "curses[.]h")
incl = "" # skip "curses.h"; it should be <curses.h>
else if (incl ~ /^..\/lib\/lua-.*\/src\/l/)
incl = "" # skip lua headers
else if (incl ~ /^curs/) # curses special case
incl = "../win/curses/" incl
else if (incl ~ /^qt/) { # Qt special cases
# qtext.h is a core header that accidentally matches...
if (incl ~ /^qtext.h/) # ...the Qt exception
incl = "../include/" incl
else if (incl ~ /(.*\/)*qt_/) { # Qt special cases
# Qt v3 headers are in ../win/Qt3
# Qt v4/v5 headers are in ../win/Qt
else if (FILENAME ~ /^\.\.\/win\/Qt3\/.*/)
incl = "../win/Qt3/" incl
else # Qt v4
incl = "../win/Qt/" incl
# Qt v4/v5/v6 headers are in ../win/Qt
# *.moc files have path in their #include
if (file ~ /[.]moc$/)
; # keep 'incl' as-is
else if (file ~ /^[.][.]\/win\/Qt3\/.*/)
incl = "../win/Qt3/" incl
else # Qt v4/v5/v6
incl = "../win/Qt/" incl
} else if (incl ~ /^gn/) # gnomehack special case
incl = "../win/gnome/" incl
else
@@ -74,14 +76,21 @@ END { output_dep() } #finish the last file
# don't do anything (we've just been collecting their dependencies);
# for .c files, output the `make' rule for corresponding .o file
#
function output_dep( targ)
function output_dep( base, targ, moc)
{
if (file ~ /\.cp*$/) {
#get the file's base name (including suffix)
base = file; sub("^.+/", "", base)
#for qt source files, add qt timestamp file as extra dependency
moc = (base ~ /[.]moc$/)
if (moc || base ~ /(.+\/)*qt_.*[.]cpp$/) {
deps[file] = deps[file] " $(QTn_H)"
}
if (base ~ /[.]cp*$/ || moc) {
#prior to very first .c|.cpp file, handle some special header file cases
if (!c_count++)
output_specials()
#construct object filename from source filename
targ = file; sub("^.+/", "", targ); sub("\\.cp*$", ".o", targ)
targ = base; sub("[.]cp*$", ".o", targ)
#format and write the collected dependencies
format_dep(targ, file)
}
@@ -97,7 +106,7 @@ function output_specials( i, sp, alt_sp)
#change "../include/foo.h" first to "foo.h", then ultimately to "$(FOO_H)"
alt_sp = sp; sub("^.+/", "", alt_sp)
print "#", alt_sp, "timestamp" #output a `make' comment
#- sub("\\.", "_", alt_sp); alt_sp = "$(" toupper(alt_sp) ")"
#- sub("[.]", "_", alt_sp); alt_sp = "$(" toupper(alt_sp) ")"
#+ Some nawks don't have toupper(), so hardwire these instead.
sub("config.h", "$(CONFIG_H)", alt_sp); sub("hack.h", "$(HACK_H)", alt_sp)
format_dep(alt_sp, sp) #output the target
@@ -111,21 +120,21 @@ function output_specials( i, sp, alt_sp)
# write a target and its dependency list in pretty-printed format;
# if target's primary source file has a path prefix, also write build command
#
function format_dep(target, source, col, n, i, list)
function format_dep(target, source, col, n, i, list, prefix, moc)
{
if (substr(target,1,1) == "$") {
prefix = ""
} else {
prefix = "$(TARGETPFX)"
}
split("", done) #``for (x in done) delete done[x]''
moc = (target ~ /[.]moc$/)
prefix = (moc || substr(target,1,1) == "$") ? "" : "$(TARGETPFX)"
printf("%s%s:", prefix, target); col = length(target) + 1 + length(prefix)
#- printf("\t"); col += 8 - (col % 8);
#- if (col == 8) { printf("\t"); col += 8 }
source = depend("", source, 0)
n = split(source, list, " +")
for (i = 2; i <= n; i++) { #(leading whitespace yields empty 1st element)
if (col + length(list[i]) >= (i < n ? 78 : 80)) {
#first: leading whitespace yields empty 1st element; not sure why moc
#files duplicate the target as next element but we need to skip that too
first = moc ? 3 : 2
for (i = first; i <= n; i++) {
if (col + length(list[i]) >= (i < n ? 78 : 80) - 1) {
printf(" \\\n\t\t"); col = 16 #make a backslash+newline split
} else {
printf(" "); col++;
@@ -134,9 +143,11 @@ function format_dep(target, source, col, n, i, list)
}
printf("\n") #terminate
#write build command if first source entry has non-include path prefix
source = list[2]
if (source ~ /\// && substr(source, 1, 11) != "../include/") {
if (source ~ /\.cpp$/ )
source = list[first]
if (moc) {
print "\t$(MOCPATH) -o $@ " source
} else if (source ~ /\// && substr(source, 1, 11) != "../include/") {
if (source ~ /[.]cpp$/ )
print "\t$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ " source
else if (source ~ /\/X11\//) # "../win/X11/foo.c"
print "\t$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ " source

View File

@@ -118,21 +118,18 @@ ifdef MAKEFILE_SRC
ifdef WANT_WIN_QT
# when switching from Qt5 to Qt6 or vice versa, any old .moc files will be
# incompatible; get rid of them in case user hasn't run 'make spotless';
# moc.qt5 and moc.qt6 are empty timestamp files and at most one should exist
# object files are incompatable with Qt library, so get rid of them too;
# Qt*.h-t are empty timestamp files and at most one should exist
QTany_H = Qt*.h-t
ifdef WANT_WIN_QT6
# Qt 6 builds and runs (with a couple of warnings) but needs more testing
MOCSTAMP=moc.qt6
QTn_H = Qt6.h-t
else
# Qt 5 is currently the default version for nethack 3.7.x's Qt interface
MOCSTAMP=moc.qt5
QTn_H = Qt5.h-t
endif
# rule to build src/qt_foo.moc from win/Qt/qt_foo.h
%.moc : ../win/Qt/%.h $(MOCSTAMP)
$(MOCPATH) -o $@ $<
moc.qt5::
@if test ! -f moc.qt5; then ( rm -f *.moc moc.qt6; touch $@ ); fi;
moc.qt6::
@if test ! -f moc.qt6; then ( rm -f *.moc moc.qt5; touch $@ ); fi;
$(QTn_H) ::
@if test ! -f $@; then ( rm -f $(QTany_H) *.moc qt_*.o; touch $@ ); fi;
endif #WANT_WIN_QT
endif #MAKFILE_SRC