mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Set up for cross-compiling under Linux, patches by Vizzini
svn path=/trunk/; revision=5234
This commit is contained in:
parent
f36e90f9c1
commit
b7fd15bf4b
5 changed files with 160 additions and 82 deletions
|
@ -17,13 +17,31 @@
|
|||
# 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
|
||||
CP = copy /Y
|
||||
MKDIR = md
|
||||
SEP = \$(EMPTY_VAR)
|
||||
endif
|
||||
|
||||
NASM_CMD = nasm
|
||||
BIN2C = ../tools/bin2c
|
||||
TOOLSDIR = ../tools
|
||||
BOOTCD_DIR = ..\..\bootcd
|
||||
NFLAGS = -fwin32 -dwin32
|
||||
BIN2C = ..$(SEP)tools$(SEP)bin2c
|
||||
TOOLSDIR = ..$(SEP)tools
|
||||
BOOTCD_DIR = ..$(SEP)..$(SEP)bootcd
|
||||
|
||||
.PHONY : clean bootcd
|
||||
|
||||
|
@ -35,46 +53,46 @@ $(BIN2C) :
|
|||
|
||||
dosmbr.bin : dosmbr.asm
|
||||
@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)
|
||||
@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
|
||||
|
||||
|
||||
fat32.bin : fat32.asm $(BIN2C)
|
||||
@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
|
||||
|
||||
isoboot.bin : isoboot.asm
|
||||
@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
|
||||
@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
|
||||
|
||||
|
||||
.PHONY : bootcd
|
||||
bootcd: bootcd_dirs isoboot.bin
|
||||
$(CP) isoboot.bin $(BOOTCD_DIR)
|
||||
$(CP) dosmbr.bin $(BOOTCD_DIR)\disk\loader
|
||||
$(CP) ext2.bin $(BOOTCD_DIR)\disk\loader
|
||||
$(CP) fat.bin $(BOOTCD_DIR)\disk\loader
|
||||
$(CP) fat32.bin $(BOOTCD_DIR)\disk\loader
|
||||
$(CP) isoboot.bin $(BOOTCD_DIR)\disk\loader
|
||||
$(CP) dosmbr.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
|
||||
$(CP) ext2.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
|
||||
$(CP) fat.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
|
||||
$(CP) fat32.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
|
||||
$(CP) isoboot.bin $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
|
||||
|
||||
.PHONY : bootcd_dirs
|
||||
bootcd_dirs:
|
||||
$(MKDIR) $(BOOTCD_DIR)
|
||||
$(MKDIR) $(BOOTCD_DIR)\disk
|
||||
$(MKDIR) $(BOOTCD_DIR)\disk\reactos
|
||||
$(MKDIR) $(BOOTCD_DIR)\disk\install
|
||||
$(MKDIR) $(BOOTCD_DIR)\disk\bootdisk
|
||||
$(MKDIR) $(BOOTCD_DIR)\disk\loader
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)reactos
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)install
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)bootdisk
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
|
||||
|
||||
clean:
|
||||
@-$(RM) *.bin
|
||||
|
|
|
@ -18,9 +18,32 @@
|
|||
#
|
||||
|
||||
|
||||
CC = gcc
|
||||
LD = ld
|
||||
RM = cmd /C del
|
||||
# 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 = /
|
||||
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
|
||||
|
||||
|
@ -36,7 +59,7 @@ fdebug.exe: $(OBJS)
|
|||
|
||||
fdebug.res: fdebug.rc resource.h
|
||||
@echo ===================================================== Compiling $*
|
||||
windres -o fdebug.res fdebug.rc -O coff
|
||||
$(WINDRES) -o fdebug.res fdebug.rc -O coff
|
||||
|
||||
fdebug.o: fdebug.c rs232.h
|
||||
@echo ===================================================== Compiling $*
|
||||
|
|
|
@ -31,7 +31,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_FDEBUG ICON DISCARDABLE "fdebug.ICO"
|
||||
IDI_FDEBUG ICON DISCARDABLE "fdebug.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -17,6 +17,33 @@
|
|||
# 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
|
||||
|
@ -28,37 +55,33 @@ TARGET = i386
|
|||
DEBUG = no
|
||||
|
||||
OBJDIR = obj
|
||||
OUTPUT_DIR = $(OBJDIR)/$(TARGET)
|
||||
OUTPUT_DIR = $(OBJDIR)$(SEP)$(TARGET)
|
||||
|
||||
BOOTCD_DIR = ../../bootcd
|
||||
BOOTCD_DIR = ..$(SEP)..$(SEP)bootcd
|
||||
|
||||
#############################################
|
||||
# COMPILER AND LINKER PROGRAMS
|
||||
#
|
||||
TOOLSDIR = $(SRCDIR)/../tools
|
||||
TOOLSDIR = $(SRCDIR)$(SEP)..$(SEP)tools
|
||||
|
||||
CC = gcc
|
||||
LD = ld
|
||||
AR = ar
|
||||
NM = nm
|
||||
RM = $(TOOLSDIR)/rdel
|
||||
CP = $(TOOLSDIR)/rcopy
|
||||
MKDIR = $(TOOLSDIR)/rmkdir
|
||||
RMDIR = $(TOOLSDIR)/rrmdir
|
||||
RM = $(TOOLSDIR)$(SEP)rdel
|
||||
CP = $(TOOLSDIR)$(SEP)rcopy
|
||||
MKDIR = $(TOOLSDIR)$(SEP)rmkdir
|
||||
RMDIR = $(TOOLSDIR)$(SEP)rrmdir
|
||||
NASM_CMD = nasm
|
||||
OBJCOPY = objcopy
|
||||
DEPTOOL = $(TOOLSDIR)/deptool
|
||||
HOSTTOOL = $(TOOLSDIR)/hosttype
|
||||
DEPTOOL = $(TOOLSDIR)$(SEP)deptool
|
||||
HOSTTOOL = $(TOOLSDIR)$(SEP)hosttype
|
||||
TOOLS = $(DEPTOOL) $(HOSTTOOL)
|
||||
|
||||
HOST = $(shell $(HOSTTOOL))
|
||||
HOSTTYPE = $(shell $(HOSTTOOL))
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------
|
||||
# TEST IF WE ARE IN THE TARGET DIRECTORY
|
||||
# IF NOT WE WILL CHANGE TO THE TARGET DIRECTORY AND RUN MAKE FROM THERE
|
||||
#-----------------------------------------------------------------------------------------------------
|
||||
#ifeq (,$(filter $(CURDIR)/$(OUTPUT_DIR),$(notdir $(CURDIR))))
|
||||
ifneq ($(CURDIR), $(SRCDIR)/$(OUTPUT_DIR))
|
||||
#ifeq (,$(filter $(CURDIR)$(SEP)$(OUTPUT_DIR),$(notdir $(CURDIR))))
|
||||
ifneq ($(CURDIR), $(SRCDIR)$(SEP)$(OUTPUT_DIR))
|
||||
|
||||
SRCDIR = $(CURDIR)
|
||||
|
||||
|
@ -68,10 +91,10 @@ SRCDIR = $(CURDIR)
|
|||
# VARIABLE TO CHANGE TO TARGET DIRECTORY AND INVOKE MAKE FROM THERE
|
||||
#
|
||||
MAKETARGET = $(MAKE) --no-print-directory -C $(OUTPUT_DIR) \
|
||||
-f ../../Makefile SRCDIR=$(CURDIR) $(MAKECMDGOALS)
|
||||
-f ..$(SEP)..$(SEP)Makefile SRCDIR=$(CURDIR) $(MAKECMDGOALS)
|
||||
|
||||
.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...
|
||||
+@$(MAKETARGET)
|
||||
|
||||
|
@ -83,9 +106,9 @@ $(OBJDIR):
|
|||
@echo Creating directory: $(OBJDIR)
|
||||
@$(MKDIR) $(OBJDIR)
|
||||
|
||||
$(OBJDIR)/$(TARGET): $(OBJDIR)
|
||||
@echo Creating directory: $(OBJDIR)/$(TARGET)
|
||||
@$(MKDIR) $(OBJDIR)/$(TARGET)
|
||||
$(OBJDIR)$(SEP)$(TARGET): $(OBJDIR)
|
||||
@echo Creating directory: $(OBJDIR)$(SEP)$(TARGET)
|
||||
@$(MKDIR) $(OBJDIR)$(SEP)$(TARGET)
|
||||
|
||||
|
||||
Makefile : ;
|
||||
|
@ -97,10 +120,10 @@ Makefile : ;
|
|||
.PHONY : clean
|
||||
clean:
|
||||
@$(MAKE) --no-print-directory -C $(TOOLSDIR)
|
||||
@echo Cleaning directory $(OBJDIR)/$(TARGET)
|
||||
@-$(RM) $(OBJDIR)/$(TARGET)/*
|
||||
@echo Removing directory $(OBJDIR)/$(TARGET)
|
||||
@-$(RMDIR) $(OBJDIR)/$(TARGET)
|
||||
@echo Cleaning directory $(OBJDIR)$(SEP)$(TARGET)
|
||||
@-$(RM) $(OBJDIR)$(SEP)$(TARGET)$(SEP)*
|
||||
@echo Removing directory $(OBJDIR)$(SEP)$(TARGET)
|
||||
@-$(RMDIR) $(OBJDIR)$(SEP)$(TARGET)
|
||||
@-$(RMDIR) $(OBJDIR)
|
||||
@echo Clean ALL done.
|
||||
|
||||
|
@ -112,20 +135,20 @@ bootcd : bootcd_dirs setup_loader boot_loader
|
|||
.PHONY : bootcd_dirs
|
||||
bootcd_dirs:
|
||||
$(MKDIR) $(BOOTCD_DIR)
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/reactos
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/install
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/bootdisk
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/loader
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)reactos
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)install
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)bootdisk
|
||||
$(MKDIR) $(BOOTCD_DIR)$(SEP)disk$(SEP)loader
|
||||
|
||||
.PHONY : boot_loader
|
||||
boot_loader : $(OBJDIR)/$(TARGET)/freeldr.sys
|
||||
$(CP) $(OBJDIR)/$(TARGET)/freeldr.sys $(BOOTCD_DIR)/disk/loader/freeldr.sys
|
||||
$(CP) ../freeldr.ini $(BOOTCD_DIR)/disk/loader/freeldr.ini
|
||||
boot_loader : $(OBJDIR)$(SEP)$(TARGET)$(SEP)freeldr.sys
|
||||
$(CP) $(OBJDIR)$(SEP)$(TARGET)$(SEP)freeldr.sys $(BOOTCD_DIR)$(SEP)disk$(SEP)loader$(SEP)freeldr.sys
|
||||
$(CP) ..$(SEP)freeldr.ini $(BOOTCD_DIR)$(SEP)disk$(SEP)loader$(SEP)freeldr.ini
|
||||
|
||||
.PHONY : setup_loader
|
||||
setup_loader : $(OBJDIR)/$(TARGET)/setupldr.sys
|
||||
$(CP) $(OBJDIR)/$(TARGET)/setupldr.sys $(BOOTCD_DIR)/disk/reactos/setupldr.sys
|
||||
setup_loader : $(OBJDIR)$(SEP)$(TARGET)$(SEP)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
|
||||
#
|
||||
COMPILER_INCLUDES = -I$(SRCDIR)/include
|
||||
COMPILER_INCLUDES = -I$(SRCDIR)$(SEP)include
|
||||
|
||||
#############################################
|
||||
# COMPILER FLAGS
|
||||
|
@ -177,10 +200,10 @@ LFLAGS = $(LINKER_OPTIONS)
|
|||
#############################################
|
||||
# NASM FLAGS
|
||||
#
|
||||
ifeq ($(HOST), dos)
|
||||
ifeq ($(HOSTTYPE), dos)
|
||||
NASMFLAGS = -f coff
|
||||
else
|
||||
ifeq ($(HOST), win32)
|
||||
ifeq ($(HOSTTYPE), win32)
|
||||
NASMFLAGS = -f win32
|
||||
else
|
||||
NASMFLAGS = -f elf
|
||||
|
@ -325,21 +348,21 @@ ALL_OBJS = $(COMMON_OBJS) \
|
|||
#############################################
|
||||
# SET THE VPATH SO MAKE CAN FIND THE SOURCE FILES
|
||||
#
|
||||
VPATH = $(SRCDIR)/ \
|
||||
$(SRCDIR)/arch/$(TARGET) \
|
||||
$(SRCDIR)/rtl \
|
||||
$(SRCDIR)/fs \
|
||||
$(SRCDIR)/ui \
|
||||
$(SRCDIR)/reactos \
|
||||
$(SRCDIR)/comm \
|
||||
$(SRCDIR)/disk \
|
||||
$(SRCDIR)/mm \
|
||||
$(SRCDIR)/cache \
|
||||
$(SRCDIR)/inifile \
|
||||
$(SRCDIR)/inffile \
|
||||
$(SRCDIR)/video \
|
||||
$(SRCDIR)/math \
|
||||
$(SRCDIR)/include
|
||||
VPATH = $(SRCDIR)$(SEP) \
|
||||
$(SRCDIR)$(SEP)arch$(SEP)$(TARGET) \
|
||||
$(SRCDIR)$(SEP)rtl \
|
||||
$(SRCDIR)$(SEP)fs \
|
||||
$(SRCDIR)$(SEP)ui \
|
||||
$(SRCDIR)$(SEP)reactos \
|
||||
$(SRCDIR)$(SEP)comm \
|
||||
$(SRCDIR)$(SEP)disk \
|
||||
$(SRCDIR)$(SEP)mm \
|
||||
$(SRCDIR)$(SEP)cache \
|
||||
$(SRCDIR)$(SEP)inifile \
|
||||
$(SRCDIR)$(SEP)inffile \
|
||||
$(SRCDIR)$(SEP)video \
|
||||
$(SRCDIR)$(SEP)math \
|
||||
$(SRCDIR)$(SEP)include
|
||||
|
||||
#############################################
|
||||
|
||||
|
|
|
@ -17,10 +17,24 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
|
||||
# Windows is default host environment
|
||||
ifeq ($(HOST),)
|
||||
HOST = mingw32-windows
|
||||
endif
|
||||
|
||||
CC = gcc
|
||||
LD = ld
|
||||
RM = cmd /C del
|
||||
#
|
||||
# Choose various options
|
||||
#
|
||||
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
|
||||
|
||||
|
@ -30,10 +44,10 @@ LIBS = -lkernel32
|
|||
|
||||
.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 :
|
||||
@$(MAKE) --no-print-directory -C ../bootsect
|
||||
..$(SEP)bootsect$(SEP)fat.h ..$(SEP)bootsect$(SEP)fat32.h :
|
||||
@$(MAKE) --no-print-directory -C ..$(SEP)bootsect
|
||||
|
||||
install.exe: $(OBJS)
|
||||
@echo ===================================================== LINKING install
|
||||
|
|
Loading…
Reference in a new issue