2017-12-19 13:29:43 +01:00
|
|
|
#
|
|
|
|
# GCC.MAK - kernel compiler options for ia16-elf-gcc
|
|
|
|
#
|
|
|
|
|
2017-12-21 19:38:41 +01:00
|
|
|
#**********************************************************************
|
|
|
|
#* 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 $@
|
|
|
|
|
2017-12-19 13:29:43 +01:00
|
|
|
CC=ia16-elf-gcc -c
|
2017-12-19 16:40:39 +01:00
|
|
|
CL=ia16-elf-gcc
|
2017-12-19 13:29:43 +01:00
|
|
|
INCLUDEPATH=.
|
|
|
|
|
2017-12-21 18:40:34 +01:00
|
|
|
LIBUTIL=ar crs
|
2017-12-19 13:29:43 +01:00
|
|
|
LIBPLUS=
|
|
|
|
LIBTERM=
|
|
|
|
|
|
|
|
TINY=-mcmodel=tiny
|
2017-12-21 18:35:47 +01:00
|
|
|
CFLAGST=-Os -fpack-struct -fcall-used-es -w -o $@
|
2017-12-19 13:29:43 +01:00
|
|
|
CFLAGSC=
|
|
|
|
|
|
|
|
#
|
|
|
|
# heavy stuff - building
|
|
|
|
#
|
|
|
|
# -mcmodel=small small memory model (small code/small data)
|
2017-12-19 16:40:39 +01:00
|
|
|
# -Os -> favor code size over execution time in optimizations
|
2017-12-19 13:29:43 +01:00
|
|
|
# -fleading-underscore underscores leading field for DOS compiler compat
|
|
|
|
# -fno-common no "common" variables, just BSS for uninitialized data
|
|
|
|
# -fpack-struct pack structure members
|
|
|
|
# -ffreestanding don't assume any headers
|
|
|
|
# -fcall-used-es es clobbered in function calls
|
|
|
|
# -mrtd use stdcall calling convention
|
|
|
|
# -w disable warnings for now
|
|
|
|
# -Werror treat all warnings as errors
|
|
|
|
|
2017-12-21 19:38:41 +01:00
|
|
|
ALLCFLAGS+=-I../hdr $(TARGETOPT) -mcmodel=small -fleading-underscore -fno-common -fpack-struct -ffreestanding -fcall-used-es -mrtd -w -Werror -Os
|
2017-12-19 13:29:43 +01:00
|
|
|
INITCFLAGS=$(ALLCFLAGS) -o $@
|
|
|
|
CFLAGS=$(ALLCFLAGS) -o $@
|
|
|
|
|
|
|
|
DIRSEP=/
|
|
|
|
RM=rm -f
|
2017-12-19 16:40:39 +01:00
|
|
|
CP=cp
|
2017-12-19 13:29:43 +01:00
|
|
|
ECHOTO=echo>>
|
2017-12-21 19:38:41 +01:00
|
|
|
ifeq ($(LOADSEG)0, 0)
|
|
|
|
LOADSEG=0x60
|
|
|
|
endif
|
|
|
|
|
2017-12-19 19:46:49 +01:00
|
|
|
INITPATCH=objcopy --redefine-sym ___umodsi3=_init_umodsi3 --redefine-sym ___udivsi3=_init_udivsi3 --redefine-sym ___ashlsi3=_init_ashlsi3 --redefine-sym ___lshrsi3=_init_lshrsi3
|
2017-12-19 13:29:43 +01:00
|
|
|
CLDEF=1
|
|
|
|
CLT=gcc -DDOSC_TIME_H -I../hdr -o $@
|
|
|
|
CLC=$(CLT)
|
2017-12-21 19:38:41 +01:00
|
|
|
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
|