Set up for cross-compiling under Linux, patches by Vizzini

svn path=/trunk/; revision=5234
This commit is contained in:
Gé van Geldorp 2003-07-23 21:27:15 +00:00
parent f36e90f9c1
commit b7fd15bf4b
5 changed files with 160 additions and 82 deletions

View file

@ -17,13 +17,31 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# Windows is default host environment
ifeq ($(HOST),)
HOST = mingw32-windows
endif
#
# Choose various options
#
ifeq ($(HOST),mingw32-linux)
RM = rm -f
CP = cp -f
MKDIR = mkdir
SEP = /
else
RM = cmd /C del RM = cmd /C del
CP = copy /Y CP = copy /Y
MKDIR = md MKDIR = md
SEP = \$(EMPTY_VAR)
endif
NASM_CMD = nasm NASM_CMD = nasm
BIN2C = ../tools/bin2c NFLAGS = -fwin32 -dwin32
TOOLSDIR = ../tools BIN2C = ..$(SEP)tools$(SEP)bin2c
BOOTCD_DIR = ..\..\bootcd TOOLSDIR = ..$(SEP)tools
BOOTCD_DIR = ..$(SEP)..$(SEP)bootcd
.PHONY : clean bootcd .PHONY : clean bootcd
@ -35,46 +53,46 @@ $(BIN2C) :
dosmbr.bin : dosmbr.asm dosmbr.bin : dosmbr.asm
@echo ===================================================== Assembling dosmbr @echo ===================================================== Assembling dosmbr
@$(NASM_CMD) -o dosmbr.bin -f bin dosmbr.asm @$(NASM_CMD) $(NFLAGS) -o dosmbr.bin -f bin dosmbr.asm
fat.bin : fat.asm $(BIN2C) fat.bin : fat.asm $(BIN2C)
@echo ===================================================== Assembling fat @echo ===================================================== Assembling fat
@$(NASM_CMD) -o fat.bin -f bin fat.asm @$(NASM_CMD) $(NFLAGS) -o fat.bin -f bin fat.asm
@$(BIN2C) fat.bin fat.h fat_data @$(BIN2C) fat.bin fat.h fat_data
fat32.bin : fat32.asm $(BIN2C) fat32.bin : fat32.asm $(BIN2C)
@echo ===================================================== Assembling fat32 @echo ===================================================== Assembling fat32
@$(NASM_CMD) -o fat32.bin -f bin fat32.asm @$(NASM_CMD) $(NFLAGS) -o fat32.bin -f bin fat32.asm
@$(BIN2C) fat32.bin fat32.h fat32_data @$(BIN2C) fat32.bin fat32.h fat32_data
isoboot.bin : isoboot.asm isoboot.bin : isoboot.asm
@echo ===================================================== Assembling isoboot @echo ===================================================== Assembling isoboot
@$(NASM_CMD) -o isoboot.bin -f bin isoboot.asm @$(NASM_CMD) $(NFLAGS) -o isoboot.bin -f bin isoboot.asm
ext2.bin : ext2.asm ext2.bin : ext2.asm
@echo ===================================================== Assembling ext2 @echo ===================================================== Assembling ext2
@$(NASM_CMD) -o ext2.bin -f bin ext2.asm @$(NASM_CMD) $(NFLAGS) -o ext2.bin -f bin ext2.asm
@$(BIN2C) ext2.bin ext2.h ext2_data @$(BIN2C) ext2.bin ext2.h ext2_data
.PHONY : bootcd .PHONY : bootcd
bootcd: bootcd_dirs isoboot.bin bootcd: bootcd_dirs isoboot.bin
$(CP) isoboot.bin $(BOOTCD_DIR) $(CP) isoboot.bin $(BOOTCD_DIR)
$(CP) dosmbr.bin $(BOOTCD_DIR)\disk\loader $(CP) dosmbr.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
$(CP) ext2.bin $(BOOTCD_DIR)\disk\loader $(CP) ext2.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
$(CP) fat.bin $(BOOTCD_DIR)\disk\loader $(CP) fat.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
$(CP) fat32.bin $(BOOTCD_DIR)\disk\loader $(CP) fat32.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
$(CP) isoboot.bin $(BOOTCD_DIR)\disk\loader $(CP) isoboot.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
.PHONY : bootcd_dirs .PHONY : bootcd_dirs
bootcd_dirs: bootcd_dirs:
$(MKDIR) $(BOOTCD_DIR) $(MKDIR) $(BOOTCD_DIR)
$(MKDIR) $(BOOTCD_DIR)\disk $(MKDIR) $(BOOTCD_DIR)$(SEP)disk
$(MKDIR) $(BOOTCD_DIR)\disk\reactos $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)reactos
$(MKDIR) $(BOOTCD_DIR)\disk\install $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)install
$(MKDIR) $(BOOTCD_DIR)\disk\bootdisk $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)bootdisk
$(MKDIR) $(BOOTCD_DIR)\disk\loader $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
clean: clean:
@-$(RM) *.bin @-$(RM) *.bin

View file

@ -18,9 +18,32 @@
# #
CC = gcc # Windows is default host environment
LD = ld ifeq ($(HOST),)
RM = cmd /C del HOST = mingw32-windows
endif
#
# Choose various options
#
ifeq ($(HOST),mingw32-linux)
RM = rm -f
CP = cp -f
MKDIR = mkdir
SEP = /
CC = mingw32-gcc
LD = mingw32-ld
WINDRES = mingw32-windres
else
RM = cmd /C del
CP = copy /Y
MKDIR = md
SEP = \$(EMPTY_VAR)
CC = gcc
LD = ld
RM = cmd /C del
WINDRES = windres
endif
FLAGS = -Wall FLAGS = -Wall
@ -36,7 +59,7 @@ fdebug.exe: $(OBJS)
fdebug.res: fdebug.rc resource.h fdebug.res: fdebug.rc resource.h
@echo ===================================================== Compiling $* @echo ===================================================== Compiling $*
windres -o fdebug.res fdebug.rc -O coff $(WINDRES) -o fdebug.res fdebug.rc -O coff
fdebug.o: fdebug.c rs232.h fdebug.o: fdebug.c rs232.h
@echo ===================================================== Compiling $* @echo ===================================================== Compiling $*

View file

@ -31,7 +31,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_FDEBUG ICON DISCARDABLE "fdebug.ICO" IDI_FDEBUG ICON DISCARDABLE "fdebug.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View file

@ -17,6 +17,33 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# Windows is default host environment
ifeq ($(HOST),)
HOST = mingw32-windows
endif
#
# Choose various options
#
ifeq ($(HOST),mingw32-linux)
RM = rm -f
CP = cp -f
CC = mingw32-gcc
LD = mingw32-ld
AR = mingw32-ar
NM = mingw32-nm
MKDIR = mkdir
SEP = /
else
RM = cmd /C del
CP = copy /Y
CC = gcc
LD = ld
AR = ar
NM = nm
MKDIR = md
SEP = /
endif
############################################# #############################################
# CHANGE THESE FOR YOUR OUTPUT # CHANGE THESE FOR YOUR OUTPUT
@ -28,37 +55,33 @@ TARGET = i386
DEBUG = no DEBUG = no
OBJDIR = obj OBJDIR = obj
OUTPUT_DIR = $(OBJDIR)/$(TARGET) OUTPUT_DIR = $(OBJDIR)$(SEP)$(TARGET)
BOOTCD_DIR = ../../bootcd BOOTCD_DIR = ..$(SEP)..$(SEP)bootcd
############################################# #############################################
# COMPILER AND LINKER PROGRAMS # COMPILER AND LINKER PROGRAMS
# #
TOOLSDIR = $(SRCDIR)/../tools TOOLSDIR = $(SRCDIR)$(SEP)..$(SEP)tools
CC = gcc RM = $(TOOLSDIR)$(SEP)rdel
LD = ld CP = $(TOOLSDIR)$(SEP)rcopy
AR = ar MKDIR = $(TOOLSDIR)$(SEP)rmkdir
NM = nm RMDIR = $(TOOLSDIR)$(SEP)rrmdir
RM = $(TOOLSDIR)/rdel
CP = $(TOOLSDIR)/rcopy
MKDIR = $(TOOLSDIR)/rmkdir
RMDIR = $(TOOLSDIR)/rrmdir
NASM_CMD = nasm NASM_CMD = nasm
OBJCOPY = objcopy OBJCOPY = objcopy
DEPTOOL = $(TOOLSDIR)/deptool DEPTOOL = $(TOOLSDIR)$(SEP)deptool
HOSTTOOL = $(TOOLSDIR)/hosttype HOSTTOOL = $(TOOLSDIR)$(SEP)hosttype
TOOLS = $(DEPTOOL) $(HOSTTOOL) TOOLS = $(DEPTOOL) $(HOSTTOOL)
HOST = $(shell $(HOSTTOOL)) HOSTTYPE = $(shell $(HOSTTOOL))
#----------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------
# TEST IF WE ARE IN THE TARGET DIRECTORY # TEST IF WE ARE IN THE TARGET DIRECTORY
# IF NOT WE WILL CHANGE TO THE TARGET DIRECTORY AND RUN MAKE FROM THERE # IF NOT WE WILL CHANGE TO THE TARGET DIRECTORY AND RUN MAKE FROM THERE
#----------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------
#ifeq (,$(filter $(CURDIR)/$(OUTPUT_DIR),$(notdir $(CURDIR)))) #ifeq (,$(filter $(CURDIR)$(SEP)$(OUTPUT_DIR),$(notdir $(CURDIR))))
ifneq ($(CURDIR), $(SRCDIR)/$(OUTPUT_DIR)) ifneq ($(CURDIR), $(SRCDIR)$(SEP)$(OUTPUT_DIR))
SRCDIR = $(CURDIR) SRCDIR = $(CURDIR)
@ -68,10 +91,10 @@ SRCDIR = $(CURDIR)
# VARIABLE TO CHANGE TO TARGET DIRECTORY AND INVOKE MAKE FROM THERE # VARIABLE TO CHANGE TO TARGET DIRECTORY AND INVOKE MAKE FROM THERE
# #
MAKETARGET = $(MAKE) --no-print-directory -C $(OUTPUT_DIR) \ MAKETARGET = $(MAKE) --no-print-directory -C $(OUTPUT_DIR) \
-f ../../Makefile SRCDIR=$(CURDIR) $(MAKECMDGOALS) -f ..$(SEP)..$(SEP)Makefile SRCDIR=$(CURDIR) $(MAKECMDGOALS)
.PHONY: CHANGE_TO_TARGET .PHONY: CHANGE_TO_TARGET
CHANGE_TO_TARGET setupldr : BUILD_TOOLS $(OBJDIR) $(OBJDIR)/$(TARGET) CHANGE_TO_TARGET setupldr : BUILD_TOOLS $(OBJDIR) $(OBJDIR)$(SEP)$(TARGET)
@echo Calculating source file dependencies... @echo Calculating source file dependencies...
+@$(MAKETARGET) +@$(MAKETARGET)
@ -83,9 +106,9 @@ $(OBJDIR):
@echo Creating directory: $(OBJDIR) @echo Creating directory: $(OBJDIR)
@$(MKDIR) $(OBJDIR) @$(MKDIR) $(OBJDIR)
$(OBJDIR)/$(TARGET): $(OBJDIR) $(OBJDIR)$(SEP)$(TARGET): $(OBJDIR)
@echo Creating directory: $(OBJDIR)/$(TARGET) @echo Creating directory: $(OBJDIR)$(SEP)$(TARGET)
@$(MKDIR) $(OBJDIR)/$(TARGET) @$(MKDIR) $(OBJDIR)$(SEP)$(TARGET)
Makefile : ; Makefile : ;
@ -97,10 +120,10 @@ Makefile : ;
.PHONY : clean .PHONY : clean
clean: clean:
@$(MAKE) --no-print-directory -C $(TOOLSDIR) @$(MAKE) --no-print-directory -C $(TOOLSDIR)
@echo Cleaning directory $(OBJDIR)/$(TARGET) @echo Cleaning directory $(OBJDIR)$(SEP)$(TARGET)
@-$(RM) $(OBJDIR)/$(TARGET)/* @-$(RM) $(OBJDIR)$(SEP)$(TARGET)$(SEP)*
@echo Removing directory $(OBJDIR)/$(TARGET) @echo Removing directory $(OBJDIR)$(SEP)$(TARGET)
@-$(RMDIR) $(OBJDIR)/$(TARGET) @-$(RMDIR) $(OBJDIR)$(SEP)$(TARGET)
@-$(RMDIR) $(OBJDIR) @-$(RMDIR) $(OBJDIR)
@echo Clean ALL done. @echo Clean ALL done.
@ -112,20 +135,20 @@ bootcd : bootcd_dirs setup_loader boot_loader
.PHONY : bootcd_dirs .PHONY : bootcd_dirs
bootcd_dirs: bootcd_dirs:
$(MKDIR) $(BOOTCD_DIR) $(MKDIR) $(BOOTCD_DIR)
$(MKDIR) $(BOOTCD_DIR)/disk $(MKDIR) $(BOOTCD_DIR)$(SEP)disk
$(MKDIR) $(BOOTCD_DIR)/disk/reactos $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)reactos
$(MKDIR) $(BOOTCD_DIR)/disk/install $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)install
$(MKDIR) $(BOOTCD_DIR)/disk/bootdisk $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)bootdisk
$(MKDIR) $(BOOTCD_DIR)/disk/loader $(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
.PHONY : boot_loader .PHONY : boot_loader
boot_loader : $(OBJDIR)/$(TARGET)/freeldr.sys boot_loader : $(OBJDIR)$(SEP)$(TARGET)$(SEP)freeldr.sys
$(CP) $(OBJDIR)/$(TARGET)/freeldr.sys $(BOOTCD_DIR)/disk/loader/freeldr.sys $(CP) $(OBJDIR)$(SEP)$(TARGET)$(SEP)freeldr.sys $(BOOTCD_DIR)$(SEP)disk$(SEP)loader$(SEP)freeldr.sys
$(CP) ../freeldr.ini $(BOOTCD_DIR)/disk/loader/freeldr.ini $(CP) ..$(SEP)freeldr.ini $(BOOTCD_DIR)$(SEP)disk$(SEP)loader$(SEP)freeldr.ini
.PHONY : setup_loader .PHONY : setup_loader
setup_loader : $(OBJDIR)/$(TARGET)/setupldr.sys setup_loader : $(OBJDIR)$(SEP)$(TARGET)$(SEP)setupldr.sys
$(CP) $(OBJDIR)/$(TARGET)/setupldr.sys $(BOOTCD_DIR)/disk/reactos/setupldr.sys $(CP) $(OBJDIR)$(SEP)$(TARGET)$(SEP)setupldr.sys $(BOOTCD_DIR)$(SEP)disk$(SEP)reactos$(SEP)setupldr.sys
############################################# #############################################
@ -154,7 +177,7 @@ COMPILER_DEFINES = -D__$(TARGET)__ $(COMPILER_DEBUG_DEFINES)
############################################# #############################################
# INCLUDE DIRECTORY OPTIONS # INCLUDE DIRECTORY OPTIONS
# #
COMPILER_INCLUDES = -I$(SRCDIR)/include COMPILER_INCLUDES = -I$(SRCDIR)$(SEP)include
############################################# #############################################
# COMPILER FLAGS # COMPILER FLAGS
@ -177,10 +200,10 @@ LFLAGS = $(LINKER_OPTIONS)
############################################# #############################################
# NASM FLAGS # NASM FLAGS
# #
ifeq ($(HOST), dos) ifeq ($(HOSTTYPE), dos)
NASMFLAGS = -f coff NASMFLAGS = -f coff
else else
ifeq ($(HOST), win32) ifeq ($(HOSTTYPE), win32)
NASMFLAGS = -f win32 NASMFLAGS = -f win32
else else
NASMFLAGS = -f elf NASMFLAGS = -f elf
@ -325,21 +348,21 @@ ALL_OBJS = $(COMMON_OBJS) \
############################################# #############################################
# SET THE VPATH SO MAKE CAN FIND THE SOURCE FILES # SET THE VPATH SO MAKE CAN FIND THE SOURCE FILES
# #
VPATH = $(SRCDIR)/ \ VPATH = $(SRCDIR)$(SEP) \
$(SRCDIR)/arch/$(TARGET) \ $(SRCDIR)$(SEP)arch$(SEP)$(TARGET) \
$(SRCDIR)/rtl \ $(SRCDIR)$(SEP)rtl \
$(SRCDIR)/fs \ $(SRCDIR)$(SEP)fs \
$(SRCDIR)/ui \ $(SRCDIR)$(SEP)ui \
$(SRCDIR)/reactos \ $(SRCDIR)$(SEP)reactos \
$(SRCDIR)/comm \ $(SRCDIR)$(SEP)comm \
$(SRCDIR)/disk \ $(SRCDIR)$(SEP)disk \
$(SRCDIR)/mm \ $(SRCDIR)$(SEP)mm \
$(SRCDIR)/cache \ $(SRCDIR)$(SEP)cache \
$(SRCDIR)/inifile \ $(SRCDIR)$(SEP)inifile \
$(SRCDIR)/inffile \ $(SRCDIR)$(SEP)inffile \
$(SRCDIR)/video \ $(SRCDIR)$(SEP)video \
$(SRCDIR)/math \ $(SRCDIR)$(SEP)math \
$(SRCDIR)/include $(SRCDIR)$(SEP)include
############################################# #############################################

View file

@ -17,10 +17,24 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# Windows is default host environment
ifeq ($(HOST),)
HOST = mingw32-windows
endif
CC = gcc #
LD = ld # Choose various options
RM = cmd /C del #
ifeq ($(HOST),mingw32-linux)
RM = rm -f
SEP = /
else
RM = cmd /C del
SEP = \$(EMPTY_VAR)
endif
CC = mingw32-gcc
LD = mingw32-ld
FLAGS = -Wall FLAGS = -Wall
@ -30,10 +44,10 @@ LIBS = -lkernel32
.PHONY : clean .PHONY : clean
all: ../bootsect/fat.h ../bootsect/fat32.h install.exe all: ..$(SEP)bootsect$(SEP)fat.h ..$(SEP)bootsect$(SEP)fat32.h install.exe
../bootsect/fat.h ../bootsect/fat32.h : ..$(SEP)bootsect$(SEP)fat.h ..$(SEP)bootsect$(SEP)fat32.h :
@$(MAKE) --no-print-directory -C ../bootsect @$(MAKE) --no-print-directory -C ..$(SEP)bootsect
install.exe: $(OBJS) install.exe: $(OBJS)
@echo ===================================================== LINKING install @echo ===================================================== LINKING install