Some makefiles are too large, define lots of macros. It's hard to understand. Is there any tool that can expand macros in makefile and output the new makefile? (Just as the -E option of gcc, which expands the macros in c source file)
Related
I have a project where there is a Makefile in a sub-directory and I would like to use the VS Code Makefile Tools extension to configure builds. This works fine when I open VS Code in the sub-directory where the Makefile resides. However when I open VS Code in the parent directory I cannot activate the Makefile Tools extension. I have tried following the instructions in the user documentation (https://marketplace.visualstudio.com/items?itemName=ms-vscode.makefile-tools) but this does not seem to have any effect for me. My settings are shown in the attached screenshot.
A workaround for this issue is to put a makefile in the root VS Code directory. E.g., something like,
SUBDIRS := path/to/project1 project2
all: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $#
.PHONY: all $(SUBDIRS)
Credit to this post for explaining how to nest Makefiles across sub-directories.
I would like to view preprocessed output files in Eclipse with C/C++ syntax highlighting.
So, I configured Eclipse to treat my .pp files like .c files : eclipse - how to treat file extension as C-file.
But my problem now is when I do Open Declaration on a symbol, Eclipse includes the .pp files in the search that I told it were C/C++ files which I do NOT want.
How do I tell Eclipse to apply C/C++ syntax highlighting to files .pp but to NOT treat them as actual C/C++ files?
You need to keep the file type association for semantic highlighting and other C/C++ editor features to work.
However, you can exclude the file from consideration for navigation actions like Open Declaration, by checking "Exclude resource from build" in the file's Properties | C/C++ Build.
In my checkout, there are many "C++ Eclipse projects".
To get Eclipse to index symbols, classes, etc. I manually add the paths to headers to each of these Eclipse C++ project folders in the Paths and Symbols menu.
Unfortunately, I cannot check in the .cproject files that contain this information so whenever I need to checkout a new copy . . . I have to redo everything.
QUESTION
How can I transfer these modifications to my "Path and Symbols" property of the Eclipse C++ project in the new checkout?
I haven't actually tried this, but it seems like File | Export | C/C++ | C/C++ Project Settings (and then Import the same into the new project) should work.
That said, it's worth noting that CDT has a feature that allows you to avoid manually specifying the include paths in Paths and Symbols to begin with: the build output parser.
The idea is that if your project uses a build system whose build output contains (or can be configured to contain) the full compiler invocation commands (things like g++ -I include/path/1 -I include/path/2 -o MyClass.o MyClass.cpp), CDT is able to parse this output and pick up the include paths automatically.
The build output parser can be configured in Project Properties | C/C++ General | Preprocessor Include Paths, Macros etc. | Providers | CDT GCC Build Output Parser (or replace GCC with whatever toolchain you're using).
This way, information about necessary include paths is contained in one place (your build script, e.g. makefile or similar, which presumably can be and is checked into the repository), and in each checkout of the project CDT's build output parser can pick up these settings automatically.
I have a working EDE project, but I would like to locate the command in a file in the source tree for that project and not in my .emacs file. Is this possible?
I have tried using directory variables and emacs loads the file, but it does have any affect. To do this I placed the following code in .dir-locals.el in the project root:
((nil
. ((ede-cpp-root-project "MyProj"
:name "MyProj Project"
:file "/home/jlisee/projects/myproj_code/CMakeLists.txt"
:include-path '( "/packages" )
:system-include-path '( "/opt/myproj/local/include" )
:spp-table '( ("CONST" . "const") )
))))
The project type ede-cpp-root is for people who specifically want to keep the project file out of their source tree. If you want a project type in your source tree, there are other options.
If you are using a recent version of CEDET, you can instead enable the generic project types which in turn supports cmake (which it looks like you are using?)
(ede-enable-generic-projects)
Once in this generic project for CMake, use
M-x ede-customize-project RET
to add in include paths, macro tables, and the like.
If you aren't using makefiles, cmake, or whatever, you can create your own generic project type with a bit of code in your .emacs file. Look in ede-generic for everything that mentions CMake, and it should be pretty obvious what 3 things to create.
I think the existing project type uses CMakeLists, not CMakeLists.txt, so perhaps the existing code needs a tweak.
I've been trying to get subprojects in EDE to work, but I don't understand much and I can't find any good documentation. What would the project configurations have to look like for the following tree:
Test
Project.el
bin
test
src
Project.el
main.cpp
class.cpp
inc
Project.el
class.h
To make a project like that, first create the toplevel project with:
M-x ede-new RET
and fill it in as an Automake or Makefile based project. (either is fine.) Then for each sub-directory, use ede-new again with the same project style. These projects will get linked together under the top-level project. You then use
M-x customize-project RET
to edit any features you need for the project. If you use dired, you can mark files and use the Project menu to add those files to some target, or create new targets to add them to. You don't need to know what is in the Project.ede files to do that. As it happens, the Project.ede file is just some Emacs Lisp code that creates the objects that represent the project you are working in.