Add C++ to Makefile

Anne

New Member

Reaction score: 1
Messages: 3

I have 3rd party build Makefile for embedded application.
The application "progress / results " is via the embedded hadrware ( I temporary do not have ) , not to "stadard" terminal / console.

For software development / debugging I like to add ability to either do standard C "printf" or C++"cout".
I do not need the app to physically run, just be able to debug my code.
I am little familiar with Make, but could use some assistance.

Here are the notes I have in Makefile

TRGT = arm-none-eabi-
CC = $(TRGT)gcc

CPPC = $(TRGT)g++

?? is this th correct way to enable C++ ???

# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc

ifeq ($(DEBUG),yes)
$(info Information add use g++ here )
LD = $(TRGT)g++
endif
CP = $(TRGT)objcopy


I "enabled" (via DEBUG ) LD = $(TRGT)g++, but my build process still cannot find #include <iostream>.
I am lost.


I understand that this forum is not specifically about make / makefile - but I need to modify Makefile
before I can run the C/C++ code.
My appology if I am off base with my post.
 

unitrunker

Active Member

Reaction score: 87
Messages: 233

You've shown us fragments of a makefile that omits essential information. What rules do you define? Are you using a template? Is this written for gmake or make(1) ? Is the code all ".c" source files or ".cpp" / ".cxx" files?
 
OP
OP
A

Anne

New Member

Reaction score: 1
Messages: 3

Thanks for your reply.

I was not sure about requesting help with Make here, so that is why such terse post.

What rules do you define? see attached full copy ( hope .txt file is OK)
Are you using a template? this is 3rd party build , I cannot answer that question
Is this written for gmake or make(1) ? this is 3rd party build , I cannot answer that question
Is the code all ".c" source files or ".cpp" / ".cxx" files? again 3rd party build , as far as I can tell all is c code - if it was cpp I should be able to do #include <iostream> and "cout" without an issue.

Since the app runs on emebedded processor (STM32F) all the i/o functions are written for attached hardware , no standard i/o console is suported.
 

Attachments

shkhln

Aspiring Daemon

Reaction score: 306
Messages: 931

So, where FreeBSD is involved in this?

I like to add ability to either do standard C "printf" or C++"cout". I do not need the app to physically run, just be able to debug my code.
I hope you do realize how nonsensical that sounds.
 

unitrunker

Active Member

Reaction score: 87
Messages: 233

Hi Anne;

This is a gnu makefile that targets chibios which is essentially commercial software. Reach out to the vendor of your arm based antenna analyzer. I don't think this forum is the appropriate venue.

That said - the makefile isn't your problem. I did not see any targets for unit tests or benchmark / performance analysis. If the code wasn't designed to be unit tested - you've got much refactoring work ahead of your. If you're up to the task, define a new static library target and move most of the C code to this new static library. Redefine the program executable target (eg. 'main.c' or 'main.cpp') to link to the static library. Add additional targets as needed. Rewriting under cmake would be easier.

Good luck.
 
OP
OP
A

Anne

New Member

Reaction score: 1
Messages: 3

Thanks for reply.
You basically confirmed my suspicion about the "product" software.
It was not build to be analyzed or intelligently modified "out of the box".
On top of that , my IDE is so flaky it will not reliably repeat common task.

As far as posting my inquries in "appropriate forum" - I am getting no responses.
There is an active USER forum whose members are just that - users and not developers.
The "product" is "maintained " on several (cloned) independent "forums" on github and that is about as close to be able to discuss deatils - such as Makefile.

I do appreciate your time and suggestion to "refactor" the whole mess.
Something I have never done, but willing to try.

I am very sorry if my post bothered some members here.

Case closed.
Cheers
 
Top