Skip to content

Commit

Permalink
One MAKEFILE to rule them all
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Risca committed Mar 8, 2023
1 parent 3ceebcd commit 949e41c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 70 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
48 changes: 26 additions & 22 deletions SOURCES/MAKEFILE
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 949e41c

Please sign in to comment.