For GCC builds use GNU make instead of wmake throughout.

This eliminates all build-dependencies on Open Watcom.
This commit is contained in:
Bart Oldeman 2017-12-21 13:38:41 -05:00 committed by Kenneth J Davis
parent 7705558b3e
commit d7a05ab6cd
4 changed files with 57 additions and 15 deletions

View File

@ -20,10 +20,10 @@ fat32lba.bin: boot32lb.asm
$(NASM) boot32lb.asm -l$*.lst -ofat32lba.bin
oemfat12.bin: oemboot.asm
$(NASM) -dISFAT12 oemboot.asm -l$*.lst -ooemfat12.bin
$(NASM) -dISFAT12 oemboot.asm -l$*.lst -ooemfat12.bin
oemfat16.bin: oemboot.asm
$(NASM) -dISFAT16 oemboot.asm -l$*.lst -ooemfat16.bin
$(NASM) -dISFAT16 oemboot.asm -l$*.lst -ooemfat16.bin
clobber: clean
-$(RM) *.bin status.me

View File

@ -43,7 +43,7 @@ kernel.exe: $(TARGET).lnk $(OBJS) $(LIBS)
$(LINK) @$(TARGET).lnk;
../bin/country.sys: country.asm
$(NASM) -o $*.sys country.asm
$(NASM) -o ../bin/country.sys country.asm
clobber: clean
-$(RM) kernel.exe kernel.sys status.me

View File

@ -74,9 +74,11 @@ endif
ifeq ($(BUILDENV),windows)
COMPILER=owwin
TEST_F=type >nul 2>nul
TOUCH=wtouch
else
COMPILER=owlinux
TEST_F=test -f
TOUCH=touch
ifndef WATCOM
WATCOM=$(HOME)/watcom
PATH:=$(WATCOM)/binl:$(PATH)
@ -87,8 +89,17 @@ XCPU=86
XFAT=32
XUPX=upx --8086 --best
XNASM=nasm
ifeq ($(COMPILER),gcc)
MAKE=make
MAKEADJUST=for i in utils lib drivers boot sys kernel; do sed 's@!include "\(.*\)"@include ../mkfiles/gcc.mak@' < $$i/makefile > $$i/GNUmakefile; done
MAKEREMOVE=for i in utils lib drivers boot sys kernel; do rm -f $$i/GNUmakefile; done
XLINK=ia16-elf-gcc
else
MAKE=wmake -ms -h
MAKEADJUST=
MAKEREMOVE=
XLINK=wlink
endif
#ALLCFLAGS=-DDEBUG
-include config.mak
@ -97,8 +108,9 @@ ifdef XUPX
endif
all:
$(MAKEADJUST)
cd utils && $(MAKE) production
cd lib && ( $(TEST_F) libm.lib || wtouch libm.lib )
cd lib && ( $(TEST_F) libm.lib || $(TOUCH) libm.lib )
cd drivers && $(MAKE) production
cd boot && $(MAKE) production
cd sys && $(MAKE) production
@ -119,3 +131,4 @@ clobber:
cd boot && $(MAKE) clobber
cd sys && $(MAKE) clobber
cd kernel && $(MAKE) clobber
$(MAKEREMOVE)

View File

@ -2,16 +2,35 @@
# GCC.MAK - kernel compiler options for ia16-elf-gcc
#
#**********************************************************************
#* TARGET : we create a %TARGET%.sys file
#* TARGETOPT : options, handled down to the compiler
#**********************************************************************
TARGET=KGC$(XCPU)$(XFAT)
TARGETOPT=-march=i8086
ifeq ($(XCPU),186)
TARGETOPT=march=i80186
ALLCFLAGS+=-DI186
endif
ifeq ($(XCPU),386)
TARGETOPT=-march=i80286
ALLCFLAGS+=-DI386
endif
ifeq ($(XFAT),32)
ALLCFLAGS+=-DWITHFAT32
NASMFLAGS+=-DWITHFAT32
endif
NASM=$(XNASM)
NASMFLAGS+=-i../hdr/ -DXCPU=$(XCPU) -felf -o $@
CC=ia16-elf-gcc -c
CL=ia16-elf-gcc
INCLUDEPATH=.
!if $(XCPU) != 186
!if $(XCPU) != 386
TARGETOPT=-march=i8086
!endif
!endif
LIBUTIL=ar crs
LIBPLUS=
LIBTERM=
@ -20,8 +39,6 @@ TINY=-mcmodel=tiny
CFLAGST=-Os -fpack-struct -fcall-used-es -w -o $@
CFLAGSC=
TARGET=KGC
#
# heavy stuff - building
#
@ -36,17 +53,29 @@ TARGET=KGC
# -w disable warnings for now
# -Werror treat all warnings as errors
ALLCFLAGS=-I../hdr $(TARGETOPT) $(ALLCFLAGS) -mcmodel=small -fleading-underscore -fno-common -fpack-struct -ffreestanding -fcall-used-es -mrtd -w -Werror -Os
ALLCFLAGS+=-I../hdr $(TARGETOPT) -mcmodel=small -fleading-underscore -fno-common -fpack-struct -ffreestanding -fcall-used-es -mrtd -w -Werror -Os
INITCFLAGS=$(ALLCFLAGS) -o $@
CFLAGS=$(ALLCFLAGS) -o $@
NASMFLAGS=$(NASMFLAGS) -f elf -o $@
DIRSEP=/
RM=rm -f
CP=cp
ECHOTO=echo>>
ifeq ($(LOADSEG)0, 0)
LOADSEG=0x60
endif
INITPATCH=objcopy --redefine-sym ___umodsi3=_init_umodsi3 --redefine-sym ___udivsi3=_init_udivsi3 --redefine-sym ___ashlsi3=_init_ashlsi3 --redefine-sym ___lshrsi3=_init_lshrsi3
CLDEF=1
CLT=gcc -DDOSC_TIME_H -I../hdr -o $@
CLC=$(CLT)
XLINK=$(CL) -Tkernel.ld -Wl,-Map,kernel.map -o kernel.exe $(OBJS) -Wl,--whole-archive ../drivers/device.lib -Wl,--no-whole-archive $#
LINK=$(XLINK) -Tkernel.ld -Wl,-Map,kernel.map -o kernel.exe $(OBJS) -Wl,--whole-archive ../drivers/device.lib -Wl,--no-whole-archive \#
.SUFFIXES: .obj .asm
# *Implicit Rules*
.asm.obj :
$(NASM) -D$(COMPILER) $(NASMFLAGS) $*.asm
.c.obj :
$(CC) $(CFLAGS) $*.c