最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

makefile - Why does Borland Make (tested 4.0,5.0,5.2) echoes 'b' when using only DCONFIG - Stack Overflow

programmeradmin16浏览0评论

I need to change a legacy project that's using Borland Make 5.2 (I can't change that) and I'm trying to understand why this makefile I'm using for testing is behaving so strange.

The make.exe 5.2 is available in the free Borland 5.5 C++ compiler package.

MY=a
!ifdef CONFIG
!if ($(CONFIG)==release)
MY=b
!elif ($(CONFIG)==debug)
MY=c
!else
!error unknown: $(CONFIG)
!endif
!endif

all:
  @echo $(MY)

When I run with:

  1. make
    result is a --> OK
  2. make /DCONFIG
    result is b --> ???? why is that?
  3. make /DCONFIG=
    result is a --> OK
  4. make /DCONFIG=release
    result is b --> OK
  5. make /DCONFIG=debug
    result is c --> OK
  6. make /DCONFIG=invalid
    result is Fatal makefile 10: Error directive: unknown: invalid --> OK

And it's also very indent fragile (same makefile).

This gives just an error:

Error makefile 14: Unexpected end of file in conditional started at line 2

MY=a
!ifdef CONFIG
  !if ($(CONFIG)==release)
    MY=b
  !elif ($(CONFIG)==debug)
    MY=c
  !else
    !error unknown: $(CONFIG)
  !endif
!endif

all:
  @echo $(MY)

Can anyone with old-school knowledge explain this?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论