Reputation: 13624
I imported an existing make file project to eclipse. I want to compile the code with a custom make argument instead of make all
like make test
. How can I add these different make calls to project in Eclipse Luna?
Upvotes: 2
Views: 3612
Reputation:
The answer from URaoul helped me find another answer. (Update: Later I realized that the more correct answer than mine is to use "Build Configurations")
There is a menu command "Make Targets". You can find it in menu: Project/Make Targes
. Or you can simply press "Shift-F9".
So you need to create one or a few targes. So for my makefile:
.PHONY: all test autotest
all: program
program: main.o
$(CXX) $(LDFLAGS) -o $@ $^
test:
./program
autotest:
echo "Autotests"
./program
echo "Autotests completed"
clean:
rm *.o program
I created three targets in "Make target":
One of them is "run my autotests" which has a custom build command:
One of them is all, which has a default command:
Upvotes: 4
Reputation: 553
Open the project properties (right mouse on project name in the Project Explorer view and select Properties at the bottom on the context menu).
On the C/C++ Build Page, on its Builder Settings tab, uncheck Use default build command and change the makecommand to make -f hello.mak or whatever command you need.
Upvotes: 2
Reputation: 6590
You can create a external tool which runs any command line command you can think of. Just click in arrow near the icon and select "External Tools Configurations".
Upvotes: 0
Reputation:
In any project you have main file usually "makefile." You must edit this file.
if you look through the main makefile you'll find something like this:
all: #usually with dependencies.
This is a make rule, to make your own just add it in the same way:
test: #some command or dependency.
Then when you do make test it will do what you asked it to.
check this out for some more examples and better understanding on makefile rules.
GNU Make
here's some stuff for making new files in eclipse if you haven't seen it yet.
makefile in Eclipse
Upvotes: 0