• makefile ifeq ($(LANG),) 判断操作系统


    ifeq ($(LANG),)
    
    # Customize for Windows
    # The MIPS gcc compiler must use the cygwin1.dll that came with the compiler.
    CC_X86 = cl /O1 /nologo
    CP = copy
    RM = del
    DWIN32 = -DWIN32
    BIN_MIPS = ..\gccmips_elf
    VHDL_DIR = ..\vhdl
    LINUX_PWD =
    GCC_MIPS  = $(BIN_MIPS)\gcc $(CFLAGS)
    AS_MIPS   = $(BIN_MIPS)\as
    LD_MIPS   = $(BIN_MIPS)\ld
    DUMP_MIPS = $(BIN_MIPS)\objdump
    CONVERT_BIN = $(LINUX_PWD)convert_bin.exe
    
    else
    
    # Customized for Linux
    # See http://www.opencores.com/projects.cgi/web/mips/linux_tools.htm
    CC_X86 = gcc -Wall -O -g
    CP = cp
    RM = rm -rf 
    DWIN32 =
    BIN_MIPS = 
    VHDL_DIR = ../vhdl
    LINUX_PWD = ./
    #GCC_MIPS  = $(BIN_MIPS)mips-elf-gcc $(CFLAGS)
    #AS_MIPS   = $(BIN_MIPS)mips-elf-as
    #LD_MIPS   = $(BIN_MIPS)mips-elf-ld
    #DUMP_MIPS = $(BIN_MIPS)mips-elf-objdump
    GCC_MIPS = mips-uclibc-gcc $(CFLAGS)
    AS_MIPS = mips-uclibc-as
    LD_MIPS = mips-uclibc-ld
    DUMP_MIPS = mips-uclibc-objdump
    CONVERT_BIN = $(LINUX_PWD)convert_bin.exe
    #CONVERT_BIN = $(BIN_MIPS)mips-elf-objcopy -I elf32-big -O binary test.axf test.bin
    
    endif

    一般情况下,linux是有 LANG这个环境变量 而window没有的,所有通过  ifeq ($(LANG),)  是否为空即可判断操作系统。

    windows情况下,一般情况是要用cl.exe 编译的,所以要用if 之下 else之上的块。

    但是,不一般的情况,比如装个matlab,系统会增加环境变量Lang ,于是, gmake all出错了。

    判断方法  echo %LANG%   解决方案: set LANG=  (只在当前cmd窗口有效)  

  • 相关阅读:
    .Matrix-第三篇冲刺随笔
    .Matrix-第二篇冲刺随笔
    Alpha冲刺-第九次冲刺笔记
    Alpha冲刺-第八次冲刺笔记
    Alpha冲刺-第七次冲刺笔记
    Alpha冲刺-第六次冲刺笔记
    Alpha冲刺-第五次冲刺笔记
    Alpha冲刺-第四次冲刺笔记
    Alpha冲刺-第三次冲刺笔记
    Alpha冲刺-第二次冲刺笔记
  • 原文地址:https://www.cnblogs.com/mipscpu/p/2961546.html
Copyright © 2020-2023  润新知