ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
and while it does work, it does not apply the compiler's optimizations on the code. And I know that due to time my program is taking to execute (around 5x slower). I remove both $(CFLAGS) and replaced it by the
A %.o: %.cpp rule must NOT have anything behind it, so the *(DEPS) will have to be removed;
all further dependencies have to be in the recipe (the 2nd line).
Anyway, the standard flag variables for C++ compilations are CXXFLAGS or CPPFLAGS
I'm not sure, but do you get a different result if you change CFLAGS to CXXFLAGS (or CPPFLAGS) in all three locations of your Makefile?
Thanks, it did work.
Quote:
A %.o: %.cpp rule must NOT have anything behind it, so the *(DEPS) will have to be removed;
all further dependencies have to be in the recipe (the 2nd line).
Anyway, the standard flag variables for C++ compilations are CXXFLAGS or CPPFLAGS
You don't need to re-write all the rules for normal compilation, make has loads of rules built in. You are just getting in the way.
You don't even *need* a make file to use make rules.
Create a file called 'blah.cpp' in a directory with no make file and type 'make blah' and you will see.
'make -pns' will show you all the rules.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.