am中写入多个条件

am中写入多个条件

本文介绍了如何使用"else if"在Makefile.am中写入多个条件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用autoconf/automake编译我的项目.在我的configure.ac

I want to compile my project with autoconf/automake. There are 2 conditions defined in my configure.ac

AM_CONDITIONAL(HAVE_CLIENT, test $enable-client -eq 1)
AM_CONDITIONAL(HAVE_SERVER, test $enable-server -eq 1)

我想将_LIBS与Makefile.am中的这两个条件分开

I want to separate _LIBS from these 2 conditions in Makefile.am

if HAVE_CLIENT

libtest_LIBS = \

    $(top_builddir)/libclient.la

else if HAVE_SERVER

libtest_LIBS = \

    $(top_builddir)/libserver.la

else

libtest_LIBS =

endif

else if HAVE_SERVER不起作用.

如何在makefile.am中写"else if"?

How to write 'else if' in makefile.am?

推荐答案

ptomato的代码也可以采用更简洁的方式编写,例如:

ptomato's code can also be written in a cleaner manner like:


ifeq ($(TARGET_CPU),x86)
  TARGET_CPU_IS_X86 := 1
else ifeq ($(TARGET_CPU),x86_64)
  TARGET_CPU_IS_X86 := 1
else
  TARGET_CPU_IS_X86 := 0
endif

这不能回答OP的问题,但是由于它是google上的最佳搜索结果,因此我在这里添加了它,以防对其他人有用.

This doesn't answer OP's question but as it's the top result on google, I'm adding it here in case it's useful to anyone else.

这篇关于如何使用"else if"在Makefile.am中写入多个条件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 10:21