Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with a makefile that calls other makefiles #97

Open
SethGower opened this issue Feb 4, 2020 · 2 comments
Open

Doesn't work with a makefile that calls other makefiles #97

SethGower opened this issue Feb 4, 2020 · 2 comments

Comments

@SethGower
Copy link

I was hoping this would be able to handle this properly, since I this is how the build system at my job works, but compiledb can't seem to capture the make instances of the subshells/subprocesses when the makefile that it is called on calls make on another directory. Below is an example of what I am talking about

all:
	make -f Makefile -C ./4 all
	make -f Makefile -C ./5 all
	make -f Makefile -C ./6 all
	make -f Makefile -C ./7 all
	make -f Makefile -C ./8 all
clean:
	make -f Makefile -C ./4 clean
	make -f Makefile -C ./5 clean
	make -f Makefile -C ./6 clean
	make -f Makefile -C ./7 clean
	make -f Makefile -C ./8 clean

Each of these subdirectories is just an arbitrary homework assignment for a class I took, and had readily available to test with. This simply generates

[]

It isn't really necessary to include the source code (and I can't, since homework) but this is the compile_commands.json when using bear make

I tried it with compiledb make MAKE='compiledb -o ../compile_commands.json', and updated the Makefile to be

MAKE=make
all:
	$(MAKE) -f Makefile -C ./4 all
	$(MAKE) -f Makefile -C ./5 all
	$(MAKE) -f Makefile -C ./6 all
	$(MAKE) -f Makefile -C ./7 all
	$(MAKE) -f Makefile -C ./8 all
clean:
	$(MAKE) -f Makefile -C ./4 clean
	$(MAKE) -f Makefile -C ./5 clean
	$(MAKE) -f Makefile -C ./6 clean
	$(MAKE) -f Makefile -C ./7 clean
	$(MAKE) -f Makefile -C ./8 clean

and this yielded this.

The latter Makefile is similar to how it does it at my job, but I am even getting errors (some files aren't being intercepted) when using bear bear -o /path/to/compile_commands.json -a make MAKE='bear -o /path/to/compile_commands.json -a', and it is starting to irritate me. If it helps, I am using Texas Instruments' vision_sdk, and the build system really irritates me. If you have any other suggestions, that would be great. I have also tested it, it doesn't work (doesn't add the compiler options to the db) if the makefile that is being called calls another makefile which then calls another one (using the passing in MAKE= method).

@Str1ker17
Copy link

Str1ker17 commented Dec 11, 2020

Some suggestions to try:

  1. Have you tried pipelining, i.e. make | compiledb?
  2. You can use a hidden -c or --cmd options to tell compiledb how to build your project, if the compilation command is not a simple make.
    @click.option('-c', '--cmd', 'make_cmd', nargs=1, required=False,

    help="Command to be used as make executable.")

@SeanPcWoo
Copy link

@SethGower Hi,I meet the same question with u.
Do u have any other method to solve it now?
this question also cause that My project can not wrok in Clion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants