From 949e41c14526c03cad9bcc39a5a0718f84f9feda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Dahlstr=C3=B6m?= Date: Sat, 4 Mar 2023 13:47:38 +0100 Subject: [PATCH] One MAKEFILE to rule them all This changes so that SOURCES/MAKEFILE has built in dependencies to all the other libraries it needs to create LBA0.EXE. It will automatically run wmake in the directories where a library is missing. It also removes the need for LINK.LD altogether. The (Open) Watcom C/C++ Tools User Guide states: > Under DOS, an asterisk prefix (*) will cause Make to examine the length of the command argument. If it is > too long (> 126 characters), it will take the command argument and stuff it into a temporary environment > variable and then execute the command with "@env_var" as its argument. ... > The command must, of course, support the "@env_var" syntax. Typically, DOS commands do not support > this syntax but many of the Open Watcom tools do. This is used to pass the full list of objects and libraries directly on the command line to wlink, so a temporary file is no longer needed with the linker directives. --- .github/workflows/main.yml | 48 -------------------------------------- SOURCES/MAKEFILE | 48 +++++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 70 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a261d1..7fbdb36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,54 +40,6 @@ jobs: echo "LIB386_PATH: $env:LIB386_PATH" echo "INCLUDE: $env:INCLUDE" - - name: Build LIB_3D - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_3D" - wmake - Pop-Location - - - name: Build LIB_CD - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_CD" - wmake - Pop-Location - - - name: Build LIB_MENU - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_MENU" - wmake - Pop-Location - - - name: Build LIB_MIDI - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_MIDI" - wmake - Pop-Location - - - name: Build LIB_MIX - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_MIX" - wmake - Pop-Location - - - name: Build LIB_SAMP - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_SAMP" - wmake - Pop-Location - - - name: Build LIB_SVGA - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_SVGA" - wmake - Pop-Location - - - name: Build LIB_SYS - run: | - Push-Location "$env:GITHUB_WORKSPACE\LIB386\LIB_SYS" - wmake - Pop-Location - - name: Build LBA0.exe run: | Push-Location "$env:GITHUB_WORKSPACE\SOURCES" diff --git a/SOURCES/MAKEFILE b/SOURCES/MAKEFILE index aacec25..3d6c32e 100644 --- a/SOURCES/MAKEFILE +++ b/SOURCES/MAKEFILE @@ -34,37 +34,41 @@ CFLAGS = /oeaxt /zp2 /4s /zq /v /s /DWATCOM9 CFLAGS = /onatx /oh /oi /ei /zp2 /6s /fp6 /s /wx /wcd=131 /wcd=202 /wcd=303 /wcd=308 !endif AFLAGS = /Cx /c /W0 /Sa /DNoLanguage=SYSCALL /omf +LFLAGS = option stack=7000 +LFLAGS += system dos4g # /d2 # /"OPTION SYMFILE=LBA.SYM OPTION MAP=LBA.MAP" .SILENT -OBJETS1 = version.obj perso.obj object.obj global.obj -OBJETS2 = flipbox.obj diskfunc.obj fiche.obj extra.obj incrust.obj -OBJETS3 = grille.obj grille_a.obj func.obj cpymask.obj -OBJETS4 = Message.obj ambiance.obj Balance.obj gamemenu.obj fire.obj -OBJETS5 = geretrak.obj gerelife.obj -OBJETS6 = HoloMap.obj playfla.obj adfli_a.obj mcga.obj -OBJETS7 = msg_cust.obj +OBJECTS = version.obj perso.obj object.obj global.obj +OBJECTS += flipbox.obj diskfunc.obj fiche.obj extra.obj incrust.obj +OBJECTS += grille.obj grille_a.obj func.obj cpymask.obj +OBJECTS += Message.obj ambiance.obj Balance.obj gamemenu.obj fire.obj +OBJECTS += geretrak.obj gerelife.obj +OBJECTS += HoloMap.obj playfla.obj adfli_a.obj mcga.obj +OBJECTS += msg_cust.obj + +LIBS = $(%LIB386_PATH)\LIB_3D\LIB_3D.LIB +LIBS += $(%LIB386_PATH)\LIB_CD\LIB_CD.LIB +LIBS += $(%LIB386_PATH)\LIB_MENU\LIB_MENU.LIB +LIBS += $(%LIB386_PATH)\LIB_MIDI\LIB_MIDI.LIB +LIBS += $(%LIB386_PATH)\LIB_MIX\LIB_MIX.LIB +LIBS += $(%LIB386_PATH)\LIB_SAMP\LIB_WAVE.LIB +LIBS += $(%LIB386_PATH)\LIB_SVGA\LIB_SVGA.LIB +LIBS += $(%LIB386_PATH)\LIB_SYS\LIB_SYS.LIB EXE = LBA0 +# This is the GNU Make equivalent of CURDIR := +CURDIR = $+ $(%cdrive):$(%cwd) $- -$(EXE).exe: LINK.LD - $(WL) Name $@ @ $< +$(EXE).exe: $(LIBS) $(OBJECTS) + *$(WL) Name $@ $(LFLAGS) Library { $LIBS } File { $OBJECTS } -LINK.LD: $(OBJETS1) $(OBJETS2) $(OBJETS3) $(OBJETS4) $(OBJETS5) $(OBJETS6) $(OBJETS7) - if exist $@ del $@ - echo option stack=7000 >> $@ - echo system dos4g >> $@ - for %%G in ($<) do echo File %%G >> $@ - echo Library %LIB386_PATH%\LIB_3D\LIB_3D.LIB >> $@ - echo Library %LIB386_PATH%\LIB_CD\LIB_CD.LIB >> $@ - echo Library %LIB386_PATH%\LIB_MENU\LIB_MENU.LIB >> $@ - echo Library %LIB386_PATH%\LIB_MIDI\LIB_MIDI.LIB >> $@ - echo Library %LIB386_PATH%\LIB_MIX\LIB_MIX.LIB >> $@ - echo Library %LIB386_PATH%\LIB_SAMP\LIB_WAVE.LIB >> $@ - echo Library %LIB386_PATH%\LIB_SVGA\LIB_SVGA.LIB >> $@ - echo Library %LIB386_PATH%\LIB_SYS\LIB_SYS.LIB >> $@ +$(LIBS): + cd $^: + $(MAKE) + @cd $(CURDIR) .c.obj : PRNTITRE M "$*.C"