dosemu2 / comcom64

64bit command.com
https://github.com/dosemu2/comcom32/
GNU General Public License v3.0
32 stars 5 forks source link

Makefile not suitable for building from DOS #30

Closed jschwartzenberg closed 5 years ago

jschwartzenberg commented 5 years ago

The included Makefile does not really work well in DOS. To quickly install DJGPP inside DOSEMU2 (this script right now requires the latest commit to run inside comcom32): https://github.com/jschwartzenberg/dos-download-scripts/blob/master/dosemu/insdjgpp.bat

Issues I see now:

  1. cmp is not available, this seems to be a shell built-in on other platforms. This should be replaced to let comcom32 be able to be used to build itself.
  2. i586-pc-msdosdjgpp-gcc is just gcc

A batch file build.bat as follows allows me to build comcom32 within a default DOSEMU2 after I installed DJGPP with the above script:

gcc -Wall -O2 -finline-functions -Wmissing-declarations -c command.c
gcc -Wall -O2 -finline-functions -Wmissing-declarations -c cmdbuf.c
gcc -Wall -O2 -finline-functions -Wmissing-declarations -c cmdbuf.c
gcc -Wall -O2 -finline-functions -Wmissing-declarations -c version.c
gcc command.o cmdbuf.o version.o -o comcom32.exe
stsp commented 5 years ago

Is cmp not somewhere in gnudos?

stsp commented 5 years ago

Yes, cmp.exe is even in dosemu-freedos-1.0-bin.tgz in gnu/

jschwartzenberg commented 5 years ago

That still leaves the second issue though. i586-pc-msdosdjgpp-gcc being hardcoded.

stsp commented 5 years ago

Sure.

jschwartzenberg commented 5 years ago

It still doesn't work:

L:\>make
Bad command or filename - "git".
i586-pc-msdosdjgpp-gcc -Wall -O2 -finline-functions -Wmissing-declarations  -c command.c
make.exe: *** [Makefile:41: command.o] Error -1

I made this change:

diff --git a/Makefile b/Makefile
index 495043e..0d57296 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 # Project: FreeDOS-32 command
 # Makefile for DJGPP and Mingw32

-DOS_CC ?= i586-pc-msdosdjgpp-gcc
-DOS_LD ?= i586-pc-msdosdjgpp-gcc
-DOS_STRIP ?= i586-pc-msdosdjgpp-strip
+DOS_CC ?= gcc
+DOS_LD ?= gcc
+DOS_STRIP ?= strip
 PREFIX ?= /usr/local
 DATADIR ?= $(PREFIX)/share/comcom32
 C_OPT = -Wall -O2 -finline-functions -Wmissing-declarations

Then I get this output:

L:\>make
Bad command or filename - "git".
gcc -Wall -O2 -finline-functions -Wmissing-declarations  -c command.c
echo '"git "' | cmp -s - "version" || echo '"git "' > "version"
Bad command or filename - "cmp".
No command name seen.
make.exe: *** [Makefile:28: version] Error -1

I tried make clean, it also doesn't work:

L:\>make clean
Bad command or filename - "git".
rm -f comcom32.exe
make.exe: *** [Makefile:23: clean] Error -1

In comcom32, rm should be del.

Maybe the easiest way to support building from comcom32 itself would be provide a Makefile.dos?