makefile

来自「经典的嵌入式教程C和C++的内容中的源代码」· 代码 · 共 66 行

TXT
66
字号

## Directory name for obj-files
ObjDir=.\bin

## Directory name for exe-files
BinDir=.\bin

SRCDIR=.\src

## Name of the test application to build
BinName=IppsCpp.exe

# When Intel C++ compiler is used CC variable should be set to CC=icl.exe
CC=cl.exe

## LINKER

LINK=link.exe

################################################################################
#IPPLIB=ipps20.lib  ippcorel.lib
IPPLIB=ipps.lib ippcore.lib


# check if tools.ini file is used

Objs= \
    "$(ObjDir)\IppsCpp.obj" 

COpt=-c -EHsc -W3 -O2 -MT -Y- $(LIBINC)
CExtra=-DNDEBUG /D_WINDOWS /D _ATL_MIN_CRT /D_MBCS  /D_CRT_SECURE_NO_DEPRECATE

CFLAGS=$(COpt) $(CExtra)

################################################################

all : prepare build

build : $(BinDir)\$(BinName)

{$(SRCDIR)}.cpp{$(ObjDir)}.obj::
   $(CC)  $(CFLAGS) /Fo$(ObjDir)\ $<

$(BinDir)\$(BinName) : $(Objs)
   $(LINK) $(IPPLIB)  /nologo   /incremental:no /machine:I386  /out:$@ $(Objs)

run : $(BinDir)\$(BinName)
   @$(BinDir)\$(BinName)

prepare :
   @if not exist $(ObjDir)   mkdir $(ObjDir)
   @if not exist $(BinDir)   mkdir $(BinDir)

clean:
   @echo Cleaning ...
   @if exist $(ObjDir) rd /s /q $(ObjDir)
   @if exist $(BinDir) rd /s /q $(BinDir)

help:
   @echo Usage of this Makefile:
   @echo "nmake"            - prepare and build phases
   @echo "nmake prepare"    - creates directories
   @echo "nmake clean"      - removes directories created
   @echo "nmake build"      - builds
   @echo "nmake help"       - help

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?