diff options
Diffstat (limited to 'BaseTools/Source/C/Makefiles')
-rw-r--r-- | BaseTools/Source/C/Makefiles/NmakeSubdirs.bat | 40 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/app.makefile | 27 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/footer.makefile | 34 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/header.makefile | 67 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/lib.makefile | 18 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/ms.app | 34 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/ms.common | 60 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/ms.lib | 31 | ||||
-rw-r--r-- | BaseTools/Source/C/Makefiles/ms.rule | 24 |
9 files changed, 335 insertions, 0 deletions
diff --git a/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat b/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat new file mode 100644 index 0000000000..25b8790ac5 --- /dev/null +++ b/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat @@ -0,0 +1,40 @@ +@REM ## @file
+@REM #
+@REM # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+@REM # This program and the accompanying materials
+@REM # are licensed and made available under the terms and conditions of the BSD License
+@REM # which accompanies this distribution. The full text of the license may be found at
+@REM # http://opensource.org/licenses/bsd-license.php
+@REM #
+@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +
+
+@echo off
+setlocal
+SET NMAKE_COMMAND=%1
+SHIFT
+
+:loop
+if "%1"=="" goto success
+
+ECHO Building %1
+pushd %1
+nmake %NMAKE_COMMAND%
+if ERRORLEVEL 1 goto error
+ECHO %1 built successfully (%NMAKE_COMMAND%)
+ECHO.
+shift
+popd
+goto loop
+
+:success
+goto exit
+
+:error
+popd
+ENDLOCAL
+ECHO Error while making %1!
+VERIFY OTHER 2>NUL
+
+:exit
diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C/Makefiles/app.makefile new file mode 100644 index 0000000000..ed2e2fba08 --- /dev/null +++ b/BaseTools/Source/C/Makefiles/app.makefile @@ -0,0 +1,27 @@ +## @file +# +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +MAKEROOT ?= ../.. + +include $(MAKEROOT)/Makefiles/header.makefile + +APPLICATION = $(MAKEROOT)/bin/$(APPNAME) + +.PHONY:all +all: $(MAKEROOT)/bin $(APPLICATION) + +$(APPLICATION): $(OBJECTS) + $(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS) + +$(OBJECTS): ../Include/Common/BuildVersion.h + +include $(MAKEROOT)/Makefiles/footer.makefile diff --git a/BaseTools/Source/C/Makefiles/footer.makefile b/BaseTools/Source/C/Makefiles/footer.makefile new file mode 100644 index 0000000000..de7114257d --- /dev/null +++ b/BaseTools/Source/C/Makefiles/footer.makefile @@ -0,0 +1,34 @@ +## @file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +DEPFILES = $(OBJECTS:%.o=%.d) + +$(MAKEROOT)/libs-$(ARCH): + mkdir -p $(MAKEROOT)/libs-$(ARCH) + +.PHONY: install +install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY) + cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH) + +$(LIBRARY): $(OBJECTS) + $(AR) crs $@ $^ + +%.o : %.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +%.o : %.S + $(AS) -c $(ASFLAGS) $< -o $@ + +.PHONY: clean +clean: + @rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES) + +-include $(DEPFILES) diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile new file mode 100644 index 0000000000..9aa83c0390 --- /dev/null +++ b/BaseTools/Source/C/Makefiles/header.makefile @@ -0,0 +1,67 @@ +## @file
+#
+# The makefile can be invoked with
+# ARCH = x86_64 or x64 for EM64T build
+# ARCH = ia32 or IA32 for IA32 build
+# ARCH = ia64 or IA64 for IA64 build
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ARCH ?= IA32
+
+CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
+LINUX:=$(findstring Linux, $(shell uname -s))
+DARWIN:=$(findstring Darwin, $(shell uname -s))
+
+CC = gcc
+CXX = g++
+AS = gcc
+AR = ar
+LD = ld
+LINKER ?= $(CC)
+ifeq ($(ARCH), IA32)
+ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
+endif
+
+ifeq ($(ARCH), X64)
+ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
+endif
+
+INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
+CPPFLAGS = $(INCLUDE)
+CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g
+LFLAGS =
+
+ifeq ($(ARCH), IA32)
+#
+# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
+# to x86_64. So make sure tools match uname -m. You can manual have a 64-bit kernal on Snow Leopard
+# so only do this is uname -m returns i386.
+#
+uname_s = $(shell uname -s)
+ifeq ($(uname_s),Darwin)
+ CFLAGS += -arch i386
+ CPPFLAGS += -arch i386
+ LFLAGS += -arch i386
+endif
+endif
+
+
+.PHONY: all
+.PHONY: install
+.PHONY: clean
+
+all:
+
+$(MAKEROOT)/libs:
+ mkdir $(MAKEROOT)/libs
+
+$(MAKEROOT)/bin:
+ mkdir $(MAKEROOT)/bin
diff --git a/BaseTools/Source/C/Makefiles/lib.makefile b/BaseTools/Source/C/Makefiles/lib.makefile new file mode 100644 index 0000000000..dc8d90ccca --- /dev/null +++ b/BaseTools/Source/C/Makefiles/lib.makefile @@ -0,0 +1,18 @@ +## @file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+LIBRARY = $(MAKEROOT)/libs/lib$(LIBNAME).a
+
+all: $(MAKEROOT)/libs $(LIBRARY)
+
+include $(MAKEROOT)/Makefiles/footer.makefile
diff --git a/BaseTools/Source/C/Makefiles/ms.app b/BaseTools/Source/C/Makefiles/ms.app new file mode 100644 index 0000000000..7812175e7f --- /dev/null +++ b/BaseTools/Source/C/Makefiles/ms.app @@ -0,0 +1,34 @@ +## @file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!INCLUDE ..\Makefiles\ms.common + +APPLICATION = $(BIN_PATH)\$(APPNAME).exe + +all: $(APPLICATION) + +$(APPLICATION) : $(OBJECTS) + -@if not exist $(BIN_PATH) mkdir $(BIN_PATH) + $(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $** + +$(OBJECTS) : ..\Include\Common\BuildVersion.h
+
+.PHONY:clean +.PHONY:cleanall + +clean: + del /f /q $(OBJECTS) *.pdb > nul + +cleanall: + del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\*.pdb > nul + +!INCLUDE ..\Makefiles\ms.rule + diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common new file mode 100644 index 0000000000..d2fbc453ee --- /dev/null +++ b/BaseTools/Source/C/Makefiles/ms.common @@ -0,0 +1,60 @@ +## @file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!IFNDEF EDK_TOOLS_PATH +!ERROR "Please set your EDK_TOOLS_PATH!" +!ENDIF + +!IFNDEF BASE_TOOLS_PATH +!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!" +!ENDIF + +!IFNDEF ARCH +ARCH = IA32 +!ENDIF + +MAKE = nmake -nologo + +SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C +BIN_PATH = $(BASE_TOOLS_PATH)\Bin +LIB_PATH = $(BASE_TOOLS_PATH)\Lib + +SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin +SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib + +!IF "$(ARCH)"=="IA32" +ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32 +BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32 +LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32 +SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32 +SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32 +!ENDIF + +!IF "$(ARCH)"=="X64" +ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64 +BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64 +LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64 +SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64 +SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64 +!ENDIF + +CC = cl.exe +CXX = cl.exe +AS = ml.exe +AR = lib.exe +LD = link.exe +LINKER = $(LD) + +INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC) + +CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE +CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE + diff --git a/BaseTools/Source/C/Makefiles/ms.lib b/BaseTools/Source/C/Makefiles/ms.lib new file mode 100644 index 0000000000..0e418f3c8f --- /dev/null +++ b/BaseTools/Source/C/Makefiles/ms.lib @@ -0,0 +1,31 @@ +## @file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!INCLUDE ..\Makefiles\ms.common + +LIBRARY = $(LIB_PATH)\$(LIBNAME).lib + +all: $(LIBRARY) + +$(LIBRARY) : $(OBJECTS) + -@if not exist $(LIB_PATH) mkdir $(LIB_PATH) + $(AR) /nologo /out:$@ $** + +.PHONY:clean +clean: + del /f /q $(OBJECTS) *.pdb > nul + +.PHONY:cleanall +cleanall: + del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul + +!INCLUDE ..\Makefiles\ms.rule + diff --git a/BaseTools/Source/C/Makefiles/ms.rule b/BaseTools/Source/C/Makefiles/ms.rule new file mode 100644 index 0000000000..afbd5dcc4b --- /dev/null +++ b/BaseTools/Source/C/Makefiles/ms.rule @@ -0,0 +1,24 @@ +## @file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +#DEPFILES = $(OBJECTS:%.o=%.d) + +.c.obj : + $(CC) -c $(CFLAGS) $(INC) $< -Fo$@ + +.S.obj : + $(AS) -c $(ASFLAGS) $< -Fo$@ + +.cpp.obj : + $(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@ + +#-include $(DEPFILES) + |