I know how xcopy works, but is it possible to add comments to your exclude files? Something like this:
.pdb
.xml
.config
Some.dll /* excluded because ... */
This is how we did it:
.pdb
.xml
.config
/* excluded because ... */
Some.dll
Maybe a no-brainer for some, but I thought there might have been a default way of commenting in excluded files. Maybe xcopy even searches for a file with filename '/* excluded because ... */, but it works for us.
Related
Background:
Automake provides different types of distributions. After reading the docs "What Goes in a Distribution" I know how to include extra directories in general. But I'm not sure about the best way to exclude directories in this list for a single rule.
This is the part in current configure.ac that adds to the dist directories
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build_aux])
And this is the part in current Makefile.am that adds to the dist directories
SUBDIRS = sources po doc tests
EXTRA_DIST = build_windows
Furthermore Makefile.am has
AUTOMAKE_OPTIONS = dist-zip
For enabling the zip distribution.
Result: both package.tar.gz and package.zip have the same content. Therefore the following directories are included:
build_aux
build_windows
doc
m4
po
sources
tests
Question:
How to exclude build_windows in package.tar.gz and m4 in package.zip?
The short version is you don't. Different types of distributions only mean different format, but the content of these is designed to be exactly the same.
Long answer:
Different types of distributions only mean different format, but the content of these is designed to be exactly the same.
Therefore the solution for the goal is:
remove build_windows from EXTRA_DIST for having only needed content in the tar.gz distribution
remove dist-zip from AUTOMAKE_OPTIONS to prevent auto-generation of package.zip
add (or in this case edit) the dist-hook rule to manually:
check if build_windows exist (it won't exist if build from package.tar.gz)
copy the dist-content to a temporary directory
remove/add files/folders there as needed
create a package_win.zip from this folder (use a different name for preventing a possible package.zip to overwrite the file)
Edit: removing anything from the manually created dist folder will break make dist (or at least make distcheck), therefore this is only a good idea if you want to remove everything that has to do with autoconf/automake/Makfiles in general
I have a folder called code/ which has several .cpp files, that all need to be compiled into their .o versions and put in the object/ folder. I'm having some problems with defining correct variable names...
First, I defined some paths:
OBJPATH=object#All compiled .o files need to be placed here.
CODEPATH=code#All .cpp and .hpp header files reside here.
Then, I try to extract all of the filenames from the CODEPATH:
SRC=$(wildcard $(CODEPATH)/*.cpp)
And then, SRC has a value along the lines of code/A.cpp code/B.cpp code/C.cpp. I want to get rid of the code prefix, end replace it with $(OBJPATH), which evaluates to object/. I initially tried this:
TMP=$(SRC:.cpp=.o)
OBJ=$(TMP:$(CODEPATH)=$(OBJPATH))
But, as it turns out, that doesn't work because the $(var:a=b) functionality will only replace strings at the end of variables, not at arbitrary points.
If I could find a way to get rid of the code/ prefix, my problems would be gone, so how do I do it?
You can use a pattern match substitution (that's probably not what GNU make calls them though):
OBJ=$(TMP:$(CODEPATH)/%=$(OBJPATH)/%)
You should also be able to do it in one step, without the intermediate TMP:
OBJ=$(SRC:$(CODEPATH)/%.cpp=$(OBJPATH)/%.o)
I have a Makefile.am file in my source folder and some makefile.in in some subdiretories. Everything works fine but I've noticed that when I do a make dist the tarball doesn't include the makefile.in in the subdirectories. Also because of this, make distcheck fails.
I believe the only way this can happen is if you fail to specify the subdirectory is a SUBDIRS clause of the appropriate higher level Makefile.am, although it seems strange that 'everything works fine' if that is the case. Unless you are actually naming the makefile.in with a lower case m, in which case you would need to add that file to EXTRA_DIST, but the better solution would probably be to use the standard name with upper-case M.
for a VisualStudio project, i'd like cMake to put all files from a specific folder into a specific filter.
I tried:
SOURCE_GROUP(Math FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.h
)
however, this will place only the first found cpp and the first found h file into that filter. the rest of the files in the folder will be placed in the default Filters
How to do it properly?
You need to pass full names, not globbing expressions:
FILE(GLOB source_files
${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Math/*.h
)
SOURCE_GROUP(Math FILES ${source_files})
This is a GNU Make dependency resolution issue.
My problem is that I copy the source files from a remote file server to a scratch disk (which speeds up the build process by 50%). If the file copy fails, I want to use the source files from the file server, else I want to read them from the scratch disk.
I have tried to use the vpath mechanism, but the problem is that, as far as I understand, make will by default start looking for the source files in the current directory and only if it fails to find the files there, look in the directories listed with vpath.
Is it possible to have make first look in the vpath directories before looking in the current directory? Or perhaps only look in the vpath directories (and explicitly and dynamically add the current directory to vpath)?
Only way I can think of is to temporary change directory so that make always will fail to find the source files.
Look at the path to the source directory on the server. Suppose it's "/server/someplace/src/". And suppose you don't have a "src" directory in the current directory (if you do, we just have to tweak this method). Just make sure that the path to the source directory on the scratch disk ends in "/src/", such as "/scratch/wednesday/src/". Then you can do this:
SCRATCH_PATH = /scratch/wednesday/
SERVER_PATH = /server/someplace/
VPATH = $(SCRATCH_PATH) $(SERVER_PATH)
%.o: src/%.cc
$(CC) blah blah blah