Makefile substitute -I with -isystem

136 views
Skip to first unread message

Till

unread,
Jan 12, 2017, 6:40:54 PM1/12/17
to OMNeT++ Users
I need a Makefile expert.

My goal is to include referenced headers from INET-Framework with -isystem instead of -I . The reason is that INETs warnings spam my IDE and I don't find the problems caused by my own project. Also it prevents me from using -Werror. Until now I was able to do that with the following in the makefrag of my project:


# use -isystem instead of -I flag, to hide warnings in these files
RELPRJDOTS = $(subst o,,$(subst o ,/,$(patsubst %,..o,$(subst /, ,$(PROJECTRELATIVE_PATH)))))
ifneq (,$(findstring MSYS,$(shell uname -s)))
# on windows we need this hack for pathes like -Id:/...
override COPTS := $(shell echo '$(subst -I$(RELPRJDOTS)/.,-isystem $(RELPRJDOTS)/.,$(COPTS))' |sed -e 's/-I\($(subst \| ,\|,$(addsuffix \|,$(filter %:,$(subst :,: ,$(patsubst -I%,%,$(COPTS))))) \/)\)/-isystem \1/g')
else
# on unix we can use this
override COPTS := $(subst -I/,-isystem /,$(subst -I$(RELPRJDOTS)/.,-isystem $(RELPRJDOTS)/.,$(COPTS)))
endif
$(info Replaced COPTS -I directives with -isystem directive: $(COPTS))

This way all INET includes were changed and everything was nice and clean. But with OMNeT++ 5.1 the way dependencies are used will change and it is not possible anymore to use simple variables. Thus my override COPTS := will not work anymore, the variable must be recursively expanded in the target. But it is not possible to use a recursive variable in its assignment, thus I cannot change it to COPTS = ...


Has anyone a good idea, how I can get my makefile to include the referenced headers with -isystem?

Best regards
Till

Rudolf Hornig

unread,
Jan 13, 2017, 7:50:47 AM1/13/17
to OMNeT++ Users
I'm considering making use the -isystem directive in the build system for all dependent projects. It makes sense to have this a default as a project is never interested in the warnings of an other project it depends on. So probably you will not need this hack at all.

I have added this feature for the bugtracker: https://dev.omnetpp.org/bugs/view.php?id=987 Please monitor it for discussion if needed.

Rudolf

Rudolf Hornig

unread,
Jan 13, 2017, 8:28:55 AM1/13/17
to OMNeT++ Users
Oh by the way, did you try to add --system-header-prefix=inet/

to the command line? This would treat all headers that matches this prefix even if the inet deirectory itself was added with -I. It's a much easier solution in my mind... (though it is supported only by clang :( )

Or a more portable solution, probably works on most compilers: Add INET's directory also using the -isystem directoy (and simply ignore that it is also added using -I). The documentation states that if the same directory is covered by both options -isystem takes precedence.

Till

unread,
Jan 13, 2017, 6:00:20 PM1/13/17
to OMNeT++ Users
I will give your suggestions a try, but of course strongly support changing that in OMNeT++ directly. I looked through the code and I think there are three parts to change:
Makemake
Metamakemake in the IDE
and nedtool.
The change in nedtool is trivial because the includes are ignored anyway. Would be only necessary to add support for -Isystem as a parameter.
In makemake it would be necessary to distinguish between includes of the project and referenced includes. But still that seems like a small change. Maybe I take an hour and try that out and prepare a small patch

Best regards
Till

Till

unread,
Jan 14, 2017, 8:59:56 AM1/14/17
to OMNeT++ Users
Your suggestion worked for me. For anyone interested in the solution, this is what was added to makefrag:

# add -isystem for referenced projects (-I will be ignored for those also provided with -Isystem)

RELPRJDOTS = $(subst o,,$(subst o ,/,$(patsubst %,..o,$(subst /, ,$(PROJECTRELATIVE_PATH)))))

ifneq (,$(findstring MSYS,$(shell uname -s)))

# on windows we need this hack for pathes like -Id:/...

SYSINCLUDES := $(shell echo '$(subst -I$(RELPRJDOTS)/.,-isystem $(RELPRJDOTS)/.,$(INCLUDE_PATH))' |sed -e 's/-I\($(subst \| ,\|,$(addsuffix \|,$(filter %:,$(subst :,: ,$(patsubst -I%,%,$(INCLUDE_PATH))))) \/)\)/-isystem \1/g')

else

    # on unix we can use this

SYSINCLUDES := $(subst -I/,-isystem /,$(subst -I$(RELPRJDOTS)/.,-isystem $(RELPRJDOTS)/.,$(INCLUDE_PATH)))

endif

COPTS += $(SYSINCLUDES) -isystem $(OMNETPP_INCL_DIR)


I also made the required changes to make opp_makemake and nedtool aware of -isystem. Patches are attached to the feature in the bug tracker: https://dev.omnetpp.org/bugs/view.php?id=987 what I did not do is to implement that for the IDE (metamakemake) as well. I guess it is much faster for someone who has a working build system for the plugins.

Regards
Till

Wian Virgi

unread,
Jan 14, 2017, 10:49:06 AM1/14/17
to omn...@googlegroups.com
Hai everybody

Could you help me how make throughput meter and recovery time in statistic after simulation? I just found end to end delay and packet loss...
How to analisis analisis then all? In end to end delay used mean vector I just see 1 node have value from my simulation but when In packet loss I see every node in my simulation but just some node have value...
Anybody can explain to me.. I'm so confused.. Please help me my project almost done.. So need your help all... Please...

Thank you before...

--


You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.


To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.


Visit this group at https://groups.google.com/group/omnetpp.


For more options, visit https://groups.google.com/d/optout.


Wian Virgi

unread,
Jan 14, 2017, 1:10:27 PM1/14/17
to omn...@googlegroups.com

Do you now what's wrong this? Why I can't see my truputmeter in statistic result? First picture from standardhost and second from Adhochost please help me..

Till

unread,
Jan 15, 2017, 3:03:13 AM1/15/17
to OMNeT++ Users
Do you realize that it is really rude to poste your question 5 times in topics that are completely unrelated to your post? I guess there would be plenty of people happy to help you if you would just comply to the simple standards of mailinglist netiquette.
Myself I won't look into your problem as your behavior is really pissing me of!

Till

Wian Virgi

unread,
Jan 15, 2017, 4:25:17 AM1/15/17
to omn...@googlegroups.com
Oh I'm sorry... This my mistake... I'm really sorry.. Did't mean to distrub everybody... I'm just to confused last night and hopless for my problem... Really sorry from me...

Till

unread,
Jan 15, 2017, 5:29:24 AM1/15/17
to OMNeT++ Users
It's ok, I didn't want to be too harsh, but for a community to work it is necessary that everyone complies to the rules.

My suggestion is that you describe your problem more in the thread that you opened (https://groups.google.com/forum/#!topic/omnetpp/8wr4s5psPN4)
Instead of posting photos of your screen you could paste the NED that is not working at http://pastebin.com or similar.
Before, your may also want to use the search function of the mailing list. There are topics like these:
that might help you achieve your results.

Best regards
Till

Wian Virgi

unread,
Jan 15, 2017, 7:11:12 AM1/15/17
to omn...@googlegroups.com
i'll improve my attitude from now.. I'm very sorry but would you still want help me..? 
Message has been deleted

Wian Virgi

unread,
Jan 17, 2017, 1:53:19 AM1/17/17
to omn...@googlegroups.com
Thank you Mr. Till but I have different trouble..

I get error there...
        networkLayer.igmpOut --> thruputMeter_rx.in;
        networkLayer.igmpIn <-- thruputMeter_tx.out;

2017-01-16 21:54 GMT+07:00 MourKa <amr.abu...@gmail.com>:
Wian, remove all your posts in this thread as it is not related. Just make sure you have your separate post and hopefully someone will answer you.

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages