I am using autoconf. Right now I have an intermediate .cpp file that is generated. I want to have the .cpp file deleted when I do a "make clean".
I tried specifying the file in a CONFIG_CLEAN_FILES variable, but that only takes effect when I do a make distlclean. Is there a variable to set to delete the file when I do a make clean? If not, how do I do it?
Thanks
The correct MOSTLYCLEANFILES or CLEANFILES. DISTCLEANFILES is for "make distclean"
Thanks #Rhys for the correct link to http://www.gnu.org/software/automake/manual/html_node/Clean.html#Clean
Use DISTCLEANFILES, I think.
See http://www.gnu.org/software/automake/manual/html_node/Clean.html#Clean
Related
Is there a way to prevent the rpmbuild command from reading the ~/.rpmmacros file? I want to add rpmbuild to a Make target and want to get a consistent build under any user account, regardless of the options somebody might have personally set in the rpmmacros file in his home directory.
How can I do this? Or, is that actually a bad idea?
If you're looking to get the a consistent build then the rpmmacros is only one part of the problem. The build may still differ simply because it's running on a machine with different things installed. Use mock to get a truly consistent build environment.
Solved this now this by setting $HOME to an empty directory while running rpmbuild:
mkdir $MY_DIST_DIR/dummyhome
HOME=$MY_DIST_DIR/dummyhome/ rpmbuild ...
rm -r $MY_DIST_DIR/dummyhome
This is the way I install the config files:
file(GLOB ConfigFiles ${CMAKE_CURRENT_SOURCE_DIR}/configs/*.xml
${CMAKE_CURRENT_SOURCE_DIR}/configs/*.xsd
${CMAKE_CURRENT_SOURCE_DIR}/configs/*.conf)
install(FILES ${ConfigFiles} DESTINATION ${INSTDIR})
But I need to convert one of the xml files before installing it. There is an executable that can do this job for me:
./Convertor a.xml a-converted.xml
How can I automatically convert the xml file before installing it? It should be a custom command or target that installing depends on it, I just don't know how to make the install command depend on it though. Any advice would be appreciated!
Take a look at the SCRIPT version of install:
The SCRIPT and CODE signature:
install([[SCRIPT <file>] [CODE <code>]] [...])
The SCRIPT form will invoke the given CMake script files during
installation. If the script file name is a relative path it will be
interpreted with respect to the current source directory. The CODE
form will invoke the given CMake code during installation. Code is
specified as a single argument inside a double-quoted string.
For example:
install(CODE "execute_process(\"./Convertor a.xml a-converted.xml\")")
install(FILES a-converted.xml DESTINATION ${INSTDIR})
Be sure to checkout the entry for execute_process in the manual. Also be aware that macro expansion inside the CODE parameter can be a bit tricky to get right. Check the generated cmake_install.cmake in your build directory where the generated code will be placed.
I think that your specific case would work better if you were to use a custom command and target like so:
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/a-converted.xml
COMMAND ./Convertor a.xml a-converted.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Convertor
)
add_custom_target(run ALL
DEPENDS ${CMAKE_BINARY_DIR}/a-converted.xml
COMMENT "Generating a-converted.xml" VERBATIM
)
install(
FILES ${CMAKE_BINARY_DIR}/a-converted.xml
DESTINATION ${INSTDIR}
)
Note: I don't have all the details, so the directories are probably
not exactly what you'd want in your environment, although it's
a good idea to generate files in the ${CMAKE_BINARY_DIR} area.
That way you can be sure that the file a-converted.xml is built at the time you want to install it. Especially, these two rules make sure that if you make changes to the file, it gets recompiled.
I'm wondering if I can compile just a single .c file like check_http.c in de source package of nagios-plugins-1.4.15 in the dir plugins. I'm about to add a piece of code to resolve a problem encountered by PNP4NAGIOS.
I want to compile this check_http and replace the old one in the libexec folder with this new one.
Yes, you can do this. In fact, we have done it here.
Configure up the nagios-plugins source as you would normally do. Then, edit your check_http.c file to make your changes, and from within the plugin source directory, just run 'make check_http' and it will compile just that. If it claims that the file is already up to date, just 'rm check_http' and then 'make check_http'.
If it complains about a missing library (libcoreutils libnagiosplug) or or other .o files, then this is because you have never run the initial compile to make the common libraries. Go back to the base of the source tree, and do 'make all'. Then, go back to the plugins directory and try 'make check_http'.
I'm editing Android.mk of my project to fine-tune some compiler options. Every time the build process is started from scratch. I don't want to do a full rebuild after each and every change. Is there a way to do so?
GNU make has the option -o (http://unixhelp.ed.ac.uk/CGI/man-cgi?make) to do not remake the file file even if it is older than its dependencies, and do not remake anything on account of changes in file. Essentially the file is treated as very old and its rules are ignored.
This code does the trick:
ndk-build -o jni/Android.mk
So I have scons working with an alternate build location (build/ for my output files, src/ for my input files) and it works great. Except for one thing.
I'm using an IDE (TI Code Composer 4) to debug my program. I point the IDE at the output executable to run it, and what it uses for the source files for debugging is the build/ directory. I don't really care, except when I go to edit the file in the IDE, for example main.cpp, the file is really build/main.cpp which gets clobbered as soon as I run scons again. I have to remember to edit src/main.cpp instead. I am aware of this issue and yet I make the same mistake often.
Is there a way to have scons make the source files it copies into the build path read-only? (I'd ask how to get TI CCS4 to use the right source files when it is debugging an executable, but I doubt I'd get any answers.)
This page has information about wrapping InstallTargets with a chmod call.
FYI, the scons user list is quite active with many knowledgeable people and you can get answers pretty quickly.
You could always tell scons not to duplicate source files in the build directory:
SConscript('src/SConscript', variant_dir='build', duplicate=0)