这是使用DEFAULT_GOALvariables的一个例子: ifeq ($(.DEFAULT_GOAL),) $(warning no default goal is set) endif .PHONY: foo foo: ; @echo $@ $(warning default goal is $(.DEFAULT_GOAL)) # Reset the default goal. .DEFAULT_GOAL := .PHONY: bar bar: ; @echo $@ $(warning default goal is $(.DEFAULT_GOAL)) # Set our own. .DEFAULT_GOAL := foo The output is: no default goal is set default […]
我写了一个Makefile,在这里使用了一个类似的想法。 也就是说,我定义了一组目录,并使用foreach define我在每个目录中build立的所有对象。 这里我的Makefile看起来粗略 all_dirs := $(shell …) # long shell command which finds all directories all_objs := $(shell …) # long shell command which finds all objects define compile_rule $(BUILDDIR)/$(1)/%.o : $(1)/%.cpp $(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep) endef $(foreach dir,$(all_dirs:$(BUILDDIR)/%=%),$(eval $(call compile_rule,$(dir)))) all : program_name program_name: $(all_objs) $(LD) -o $@ […]
我有一个makefile ,我想包含一个特定的src文件有条件。 makefile是这样的: ############################################### # Load default top-level config include $(WORKROOT)/build/linux/config.mk ifndef START_TIME export START_TIME:="$(shell date +%s)" endif #include $(MAK_DIR)/source.inc include $(WORKROOT)/build/linux/source.inc 在config.mk是这样的: export FLAGS = \ -DFLAGA \ -DFLAGB 在source.inc我想: #IF FLAGA is defined in FLAGS in config.mk THEN: my-objs += \ $(WORKROOT)/My_DIR/specific_src.cpp #ENDIF 我怎样才能做到这一点 ?
我试图debugging一个Makefile文件,它在面值调用一个脚本试图chroot进入某个目录。 那么它也做env命令。 BCMD= bash CMD= "/build/toolcrib/prepare_final_tree >crumbs/Final-prep.out 2>&1" ${BCMD} -c "chroot /home/user/Smoothwall/bcutm/distrib /tools/bin/env -i ${CMD}" 我知道这是chroot进入指定的目录。 env -i ${CMD}是做什么用chroot作为单个命令。 运行这个命令后,它找不到/tools/bin/env命令。
我有一个Makefile,它有一行: sed -i -e 's/\(^COPTS = \)/\1$(CFLAGS) /' $(DIR)/Makefile 在将值代入之后: sed -i -e 's/\(^COPTS = \)/\1"-I/home/jagadeesh/Smoothwall/bcutm/distrib/tools//powerpc-linux/include -I/home/jagadeesh/Smoothwall/bcutm/distrib/usr/include/ncurses -I/home/jagadeesh/Smoothwall/bcutm/distrib/usr/include" /' net-tools-1.60/Makefile make运行时会出现以下错误: sed: -e expression #1, char 23: unknown option to `s' 这个sed命令要运行的net-tool-1.60 / Makefile包含以下相关行: COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)' 这个命令做了什么,Makefile的哪一行,为什么会出现错误,除了我自定义的CFLAGS和LDFLAGS,我没有修改任何东西。
我有一个C ++项目,恰好存储在一个Bazaar回购站。 该项目还使用# #definestring来显示其版本号。 有人问我们是否可以简单地将这个显示的版本号绑定到bzr回购版本号。 所以,在伪C,伪Bash,如: #define VERSION_STRING "revision $(bzr revno)" //… cout << "Starting " << VERSION_STRING; 或者。 你怎么回答这个问题? 生成文件是否运行一个脚本,将该命令的输出插入到相应的源文件中? 有没有这个macros观的解决scheme? 等等? 我对任何和所有聪明的解决scheme都是开放的,因为我在这个问题上得到了一个有教养的空白。 = d
我试图修改我的Makefile,以便我可以input任一 “make gnu”或“make intel” 它会编译所有的唯一的区别 FC = gfortran-4.8或ifort,FFLAGS = gfortran或ifort的适当标志。 有人可以帮助我到目前为止? SOURCES = a1.f a2.f a3.f OBJECTS = $(SOURCES:.f=.o) TARGET = myexececutable.x gnu: GNU_FC $(TARGET) intel: INTEL_FC $(TARGET) GNU_FC: FC = gfortran-4.8 FFLAGS = -O3 -mcmodel=medium -shared INTEL_FC: FC = ifort FFLAGS = -O3 -mcmodel medium -shared-intel $(TARGET): $(OBJECTS) $(OBJECTS): $(SOURCES) .fo: $(FC) -c $(FFLAGS) […]
我正在开发另一台计算机上的程序(第一个),并试图让它在我的新计算机上工作(第三个)。 当我去build和键入ccmake .. ,我得到这个错误: CMake Error at build/share/cmake/hdf5/hdf5-targets.cmake:67 (message): The imported target "hdf5" references the file "/home/myname/Desktop/MyProject/build/lib/libhdf5.a" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained […]
我一直在努力让服务器/客户端运行一个简单的单线程信使服务。 它能够在Visual Studio上编译,但是当我尝试在Linux上通过makefile进行编译时,使用以下命令: make client ,我得到一个非常大的错误列表。 我将提供开始部分和错误列表: 这里说它至less试图使用g ++: g ++ -g -c -o client.o client.cc cc client.o -o client client.o:in main': /home/peter/Desktop/CS360/Messaging_Service/messenger/client.cc:10: undefined reference to Messaging_Service/messenger/client.cc main': /home/peter/Desktop/CS360/Messaging_Service/messenger/client.cc:10: undefined reference to std :: allocator :: allocator()' 编辑:我注意到这里不寻常的东西。 当我打电话make client而不打电话make clean我得到以下内容: peter @ peter-VirtualBox:〜/ Desktop / CS360 / Messaging_Service / messenger $ make client cc […]
我在Linux上有一个传统的C ++项目,它使用典型的: ./configure make make install build立和安装。 我真的想用Eclipse之类的IDE来构build它。 这是可行的吗? Eclipse中是否有能够parsing原始Makefile并将其转换为Eclipse项目的东西?