Closed aarizaq closed 7 years ago
I include my modified makefrag.
#
#
WITH_TCP_NSC := $(shell (cd .. && ./inet_featuretool -q isenabled TCP_NSC && echo enabled) )
ifeq ($(WITH_TCP_NSC), enabled)
NSC_VERSION= $(shell ls -d ../3rdparty/nsc* 2>/dev/null | sed 's/^.*-//')
ifneq ($(NSC_VERSION),)
CFLAGS += -I../3rdparty/nsc-$(NSC_VERSION)/sim -DHAVE_NSC
LIBS += -Wl,-rpath,abspath ../3rdparty/nsc-$(NSC_VERSION)
endif
endif
#
# HAVE_PKGCFG := $(shell pkg-config --version 2>/dev/null) ifeq ($(strip $(HAVE_PKGCFG)),) HAVE_PKGCFG := no else HAVE_PKGCFG := yes PKGCFG := $(shell which pkg-config) endif
#
# WITH_VOIPSTREAM := $(shell (cd .. && ./inet_featuretool -q isenabled VoIPStream && echo enabled) ) ifeq ($(WITH_VOIPSTREAM), enabled) ifeq ($(HAVE_PKGCFG), yes) HAVE_FFMPEG := $(shell $(PKGCFG) --exists libavcodec libavformat libavutil && echo yes || echo no) ifeq ($(HAVE_FFMPEG), yes) LIBS += $(shell $(PKGCFG) --libs libavcodec libavformat libavutil) CFLAGS += $(shell $(PKGCFG) --cflags libavcodec libavformat libavutil) -DHAVE_FFMPEG endif HAVE_FFMPEG_AVRESAMPLE := $(shell $(PKGCFG) --exists libavresample && echo yes || echo no) ifeq ($(HAVE_FFMPEG_AVRESAMPLE), yes) LIBS += $(shell $(PKGCFG) --libs libavresample) CFLAGS += $(shell $(PKGCFG) --cflags libavresample) -DHAVE_FFMPEG_AVRESAMPLE endif endif endif
#
# WITH_VISUALIZERS := $(shell (cd .. && ./inet_featuretool -q isenabled visualization && echo enabled) ) ifeq ($(WITH_VISUALIZERS), enabled) ifeq ($(WITH_OSG), yes) LIBS += -lOpenThreads -losg -losgText -losgDB -losgEarth -losgEarthUtil endif endif
CFLAGS += -Wno-overloaded-virtual
#########################################################################
ifneq ($(OS),Windows_NT)
ifeq ($(TOOLCHAIN_NAME),gcc) PRECOMPILED_EXT=gch else ifeq ($(TOOLCHAIN_NAME),clang) PRECOMPILED_EXT=pch else PRECOMPILED_EXT= endif
PRECOMPILED_HEADER=inet/common/precompiled.h PRECOMPILED_HEADER_PCH=$(PRECOMPILED_HEADER).$(PRECOMPILED_EXT) PRECOMPILED_HEADER_D=$(PRECOMPILED_HEADER_PCH:%.$(PRECOMPILED_EXT)=%.d) CFLAGS += -include $(PRECOMPILED_HEADER)
else
PRECOMPILED_EXT= PRECOMPILED_HEADER= PRECOMPILED_HEADER_PCH=$(PRECOMPILED_HEADER).$(PRECOMPILED_EXT) PRECOMPILED_HEADER_D=$(PRECOMPILED_HEADER_PCH:%.$(PRECOMPILED_EXT)=%.d)
endif
all-pch: | pch msgheaders all
.PHONY: pch clean-pch
pch : $(PRECOMPILED_HEADER_PCH)
$(PRECOMPILED_HEADER_PCH): $(PRECOMPILED_HEADER) ifneq ("$(PRECOMPILED_EXT)","") @echo Creating precompiled header for $(TOOLCHAIN_NAME)... $(Q)$(CXX) -x c++-header $(CXXFLAGS) $(COPTS) -o $@ $< endif
clean: clean-pch clean-defines
clean-pch: $(Q)-rm -f $(PRECOMPILED_HEADER_D) $(PRECOMPILED_HEADER).pch $(PRECOMPILED_HEADER).gch
-include $(PRECOMPILED_HEADER_D)
DEFINES_FILE=inet/opp_defines.h
msgheaders: $(DEFINES_FILE)
clean-defines: $(Q)-rm -f $(DEFINES_FILE)
$(DEFINES_FILE) : $(COPTS_FILE) @echo "// Generated file, do not edit" >$(DEFINES_FILE) ifeq ($(WITH_OSG),yes) @echo "#ifndef WITH_OSG" >>$(DEFINES_FILE) @echo "#define WITH_OSG" >>$(DEFINES_FILE) @echo "#endif" >>$(DEFINES_FILE) endif
ifneq ($(MAKECMDGOALS),clean) $(info * COMPILING with:) $(info $(CXX) -c $(CXXFLAGS) $(COPTS)) $(info * LINKING with:) $(info $(SHLIB_LD) $(WHOLE_ARCHIVE_ON) $(LIBS) $(WHOLE_ARCHIVE_OFF) $(OMNETPP_LIBS) $(LDFLAGS)) $(info Compiling...) endif
Hmm. Precompiled headers are supposed to work independent of operating system. 've just tried it on wondows 10 with clang and it was generated successfully. If you have files/patches please attach them as file instead of copying them into the comment because the markdown formatting makes them unusable.
File src/makefrag
The precompilation code in makefrag throws error in windows in the file parser.y
Posible solution, check operating system
ifneq ($(OS),Windows_NT)
precompiled header support for GCC and CLANG
ifeq ($(TOOLCHAIN_NAME),gcc) PRECOMPILED_EXT=gch else ifeq ($(TOOLCHAIN_NAME),clang) PRECOMPILED_EXT=pch else PRECOMPILED_EXT= endif
PRECOMPILED_HEADER=inet/common/precompiled.h PRECOMPILED_HEADER_PCH=$(PRECOMPILED_HEADER).$(PRECOMPILED_EXT) PRECOMPILED_HEADER_D=$(PRECOMPILED_HEADER_PCH:%.$(PRECOMPILED_EXT)=%.d) CFLAGS += -include $(PRECOMPILED_HEADER)
Main target
all-pch: | pch msgheaders all
.PHONY: pch clean-pch
pch : $(PRECOMPILED_HEADER_PCH)
$(PRECOMPILED_HEADER_PCH): $(PRECOMPILED_HEADER) ifneq ("$(PRECOMPILED_EXT)","") @echo Creating precompiled header for $(TOOLCHAIN_NAME)... $(Q)$(CXX) -x c++-header $(CXXFLAGS) $(COPTS) -o $@ $< endif
clean: clean-pch clean-defines
clean-pch: $(Q)-rm -f $(PRECOMPILED_HEADER_D) $(PRECOMPILED_HEADER).pch $(PRECOMPILED_HEADER).gch
-include $(PRECOMPILED_HEADER_D)
Create oppdefines.h so important WITH* macros from OMNeT++ can be included as macros from a header file
This helps the IDE to properly enable/disable conditional code in the editor
DEFINES_FILE=inet/opp_defines.h
msgheaders: $(DEFINES_FILE)
clean-defines: $(Q)-rm -f $(DEFINES_FILE)
$(DEFINES_FILE) : $(COPTS_FILE) @echo "// Generated file, do not edit" >$(DEFINES_FILE) ifeq ($(WITH_OSG),yes) @echo "#ifndef WITH_OSG" >>$(DEFINES_FILE) @echo "#define WITH_OSG" >>$(DEFINES_FILE) @echo "#endif" >>$(DEFINES_FILE) endif
dump out the actual compiler and linker command line for easier debugging
ifneq ($(MAKECMDGOALS),clean) $(info * COMPILING with:) $(info $(CXX) -c $(CXXFLAGS) $(COPTS)) $(info * LINKING with:) $(info $(SHLIB_LD) $(WHOLE_ARCHIVE_ON) $(LIBS) $(WHOLE_ARCHIVE_OFF) $(OMNETPP_LIBS) $(LDFLAGS)) $(info Compiling...) endif
endif