Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

how compile with turbo c (Developers)

posted by mceric, Germany, 16.12.2025, 21:37

Hi!

> i've a program ... in turbo c for dos.
> I see many .c .prj and .hex ... nothing like .configure or other
> files to be launch for start compilation.
>
> 2) how i can compile ?

There is no configure, but there is make.

So you can do:

make clobber
make all
make clean

This will first remove all leftovers from previous compiles, then compile everything, then remove all object files, leaving only the final exe.

You must have turboc.cfg in your current directory.

Your actual makefile might look similar to this, taken from FORMAT:


CC=tcc
CFLAGS=-M -N -ln -w -a- -f- -f87- -DDEBUG -ms -r-
# smaller: -M -O -N -Z -w -a- -f- -ms
# minimalistic: -ms
# -M linkmap -O jump optimize -N stack check -Z register optimize
# -w warnall -a- no word align -f- no fpu emulator -f87- no fpu code
# -ms small memory model -ln no default libs linked ...
# -r register variables -k standard stack frame ...
LDFLAGS=
LDLIBS=
RM=command /c del
OBJS1=createfs.obj floppy.obj hdisk.obj main.obj savefs.obj bcread.obj prf.obj
OBJS2=userint.obj driveio.obj getopt.obj init.obj recordbc.obj uformat.obj

# build targets:

all: format.exe

format.exe: $(OBJS1) $(OBJS2)
        $(CC) $(CFLAGS) $(LDFLAGS) -eformat *.obj $(LDLIBS)

# compile targets:

# very convenient but not available in Turbo C 2.01 - generic C/OBJ rule:
# .c.obj:
#       $(CC) $(CFLAGS) -c $*.c

createfs.obj:
        $(CC) $(CFLAGS) -c createfs.c

floppy.obj:
        $(CC) $(CFLAGS) -c floppy.c

...

# clean up:

clean:
        $(RM) *.obj

clobber:
        $(RM) *.bak
        $(RM) *.dsk
        $(RM) *.exe
        $(RM) *.obj
        $(RM) *.swp


Unfortunately, Turbo C make seems to want one rule for each obj file you compile, no wildcard rule support. Also, you have to use tabs, not spaces, for the indented lines.

---
FreeDOS / DOSEMU2 / ...

 

Complete thread:

Back to the forum
Board view  Mix view
23154 Postings in 2179 Threads, 404 registered users (1 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum