// be careful with this file

#ifdef _TESTS
#	define CCC TCC
#else
#	define CCC KCC
#endif

#ifdef _TO_ASM
#	define _CSPREF -S
#	define _OUTFIX S
#	define _ASMTYPE -masm=intel
#   define LINK_KERNEL(out)
#else
#	define _CSPREF -c
#	define _OUTFIX o
#	define _ASMTYPE
#	define LINK_KERNEL(out) $(KCC) -T ./build/kernel.ld $(CLDSCR) $(COMMOBJS) $(KERNOBJS) -o $(BINDIR)/out
#endif

#define COMPILE_CONVRT1(file) $(CCC) _CSPREF $(COMMDIR)/itoa.c    -o $(COBJDIR)/file._OUTFIX
#define COMPILE_CONVRT2(file) $(CCC) _CSPREF $(COMMDIR)/atoi.c    -o $(COBJDIR)/file._OUTFIX

#define COMPILE_COMMON(file) $(CCC) _CSPREF $(COMMDIR)/file.c    -o $(COBJDIR)/file._OUTFIX
#define COMPILE_KERNEL(file) $(KCC) _CSPREF $(KERNDIR)/file.c    -o $(KOBJDIR)/file._OUTFIX

#define COBJ1(x1)                                                   $(COBJDIR)/x1.o
#define COBJ2(x1,x2)                    COBJ1(x1)                   $(COBJDIR)/x2.o
#define COBJ3(x1,x2,x3)                 COBJ2(x1,x2)                $(COBJDIR)/x3.o
#define COBJ4(x1,x2,x3,x4)              COBJ3(x1,x2,x3)             $(COBJDIR)/x4.o
#define COBJ5(x1,x2,x3,x4,x5)           COBJ4(x1,x2,x3,x4)          $(COBJDIR)/x5.o
#define COBJ6(x1,x2,x3,x4,x5,x6)        COBJ5(x1,x2,x3,x4,x5)       $(COBJDIR)/x6.o
#define COBJ7(x1,x2,x3,x4,x5,x6,x7)     COBJ6(x1,x2,x3,x4,x5,x6)    $(COBJDIR)/x7.o
#define COBJ8(x1,x2,x3,x4,x5,x6,x7,x8)  COBJ7(x1,x2,x3,x4,x5,x6,x7) $(COBJDIR)/x8.o

#define KOBJ1(x1)                                                   $(KOBJDIR)/x1.o
#define KOBJ2(x1,x2)                    KOBJ1(x1)                   $(KOBJDIR)/x2.o
#define KOBJ3(x1,x2,x3)                 KOBJ2(x1,x2)                $(KOBJDIR)/x3.o
#define KOBJ4(x1,x2,x3,x4)              KOBJ3(x1,x2,x3)             $(KOBJDIR)/x4.o
#define KOBJ5(x1,x2,x3,x4,x5)           KOBJ4(x1,x2,x3,x4)          $(KOBJDIR)/x5.o
#define KOBJ6(x1,x2,x3,x4,x5,x6)        KOBJ5(x1,x2,x3,x4,x5)       $(KOBJDIR)/x6.o
#define KOBJ7(x1,x2,x3,x4,x5,x6,x7)     KOBJ6(x1,x2,x3,x4,x5,x6)    $(KOBJDIR)/x7.o
#define KOBJ8(x1,x2,x3,x4,x5,x6,x7,x8)  KOBJ7(x1,x2,x3,x4,x5,x6,x7) $(KOBJDIR)/x8.o