Skip to content

Commit

Permalink
move flags around, better compiler naming
Browse files Browse the repository at this point in the history
- cleanup compiler naming and compiler flags
- cleanup compiler flags overrides

  - #92
  • Loading branch information
adrpo authored and OpenModelica-Hudson committed Aug 27, 2018
1 parent 689ab33 commit 95221c6
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 74 deletions.
2 changes: 1 addition & 1 deletion 3rdParty/misc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ testbp: testbp.cc boolPack.cc ../include/boolPack.h


testdouble33s: testdouble33s.cc double33s.cc ../include/double33s.h lib
$(CXX) -o testdouble33s $(SPECFLAGS) $(CCFLAGS) $(OPTFLAGS4) $(MINCLUDE) testdouble33s.cc \
$(CXX) -o testdouble33s $(SPECFLAGS) $(CXXFLAGS) $(OPTFLAGS4) $(MINCLUDE) testdouble33s.cc \
../lib/$(ABI)/libmisc.a \
-lm

Expand Down
6 changes: 1 addition & 5 deletions FMIWrapper/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ endif

include $(MAKEFILEHEADHOME)/Makefile.head

# For microsoft and Dymola
#CC=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc
#cc=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc

override CC += -pipe -O2 -frtti -Wall -Wextra -fexceptions -DUNICODE -DINTERFACE_TYPES
override CXX += -pipe -O2 -frtti -Wall -Wextra -fexceptions -DUNICODE -DINTERFACE_TYPES -std=c++11
override CXX += -pipe -O2 -frtti -Wall -Wextra -fexceptions -DUNICODE -DINTERFACE_TYPES

# deal with regex crap
ifeq (gcc,$(findstring gcc,$(CC)))
Expand Down
46 changes: 34 additions & 12 deletions Makefile.head
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ endif

ifeq ($(ABI),WINDOWS64)
ifeq (MINGW64,$(findstring MINGW64,$(shell uname)))
CC=g++
cc=gcc
LINK=g++
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
FEXT=.exe
Expand All @@ -36,9 +36,9 @@ ifeq ($(ABI),WINDOWS64)
endif
else ifeq ($(ABI),WINDOWS32)
ifeq (MINGW32,$(findstring MINGW32,$(shell uname)))
CC=g++
cc=gcc
LINK=g++
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
FEXT=.exe
Expand All @@ -52,9 +52,9 @@ else ifeq ($(ABI),WINDOWS32)
$(error No compiler found to build for WINDOWS32)
endif
else ifeq ($(ABI),MAC64)
CC=g++
cc=gcc
LINK=g++
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
SHREXT=.dylib
Expand All @@ -63,9 +63,9 @@ else ifeq ($(ABI),MAC64)
CMAKE_TARGET="-G Unix Makefiles"
INSTALL_DIR = install/mac
else
CC=g++
cc=gcc
LINK=g++
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
SHREXT=.so
Expand All @@ -81,6 +81,28 @@ TIMEHOME=$(UP)/extralibs/rtime
DEFINES= -DUSE_THREADS
OPTFLAGS4=-O2

TARGET_TRIPLE := $(subst -, ,$(shell $(CC) -dumpmachine))
TARGET_ARCH := $(word 1,$(TARGET_TRIPLE))
TARGET_OS := $(word 3,$(TARGET_TRIPLE))

EXTRAFLAGS =
ifeq ($TARGET_OS,mingw32)
else ifeq ($TARGET_OS,cygwin)
else
EXTRAFLAGS = -fPIC
endif

detected_OS := $(shell uname -s)
ifeq ($(detected_OS),Darwin)
EXTRAFLAGS += -DNO_RTIME
RTIMELIB =
else
RTIMELIB = -lrtime
endif

override CC += $(CFLAGS) $(EXTRAFLAGS)
override CXX += $(CXXFLAGS) -std=c++11 $(EXTRAFLAGS)

ifeq (MINGW64,$(findstring MINGW64,$(shell uname)))
INCLXML-WINDOWS64=-I$(OMDEV)/tools/msys/mingw64/include/libxml2
LIBXML-WINDOWS64=-L$(OMDEV)/tools/msys/mingw64/bin -lxml2-2
Expand Down
18 changes: 7 additions & 11 deletions Modelica/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ endif

include $(MAKEFILEHEADHOME)/Makefile.head

# For microsoft and Dymola
#CC=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc
#cc=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc

CC += -std=c++11 -DYY_NEVER_INTERACTIVE -fPIC
cc += -std=c++11 -DYY_NEVER_INTERACTIVE -fPIC
override CC += -DYY_NEVER_INTERACTIVE
override CXX += -DYY_NEVER_INTERACTIVE

#################################################################################
#
Expand All @@ -42,19 +38,19 @@ INCLUDES= -I. \
-I$(MISCHOME)/include

$(ABI)/%.o: %.c
$(cc) $(INCLUDES) -c $< -o $@
$(CC) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: %.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: ../common/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: $(MISCHOME)/src/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: $(MISCHOME)/src/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

OBJS= tlmforce.o

Expand Down
15 changes: 4 additions & 11 deletions OMFMISimulatorWrapper/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ endif

include $(MAKEFILEHEADHOME)/Makefile.head

# For microsoft and Dymola
#CC=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc
#cc=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc

CC := $(CC) -pipe -O2 -frtti -Wall -Wextra -fexceptions -DUNICODE -DINTERFACE_TYPES -std=c++11
cc := $(cc) -pipe -O2 -frtti -Wall -Wextra -fexceptions -DUNICODE -DINTERFACE_TYPES -std=c++11

BNAME=OMFMISimulatorWrapper$(FEXT)
MISCHOME=../3rdParty/misc

Expand All @@ -37,16 +30,16 @@ LIBS = -L${OMFMISimulatorPath}/install/lib \
-lfmilib_shared

$(ABI)/%.o: %.cpp
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: ../common/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: $(MISCHOME)/src/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: $(MISCHOME)/src/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

OBJS= main.o

Expand Down
12 changes: 6 additions & 6 deletions OpenModelica/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ include $(MAKEFILEHEADHOME)/Makefile.head
#CC=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc
#cc=mycl cl -DWIN32 -D_WIN32 -DXMSTATIC -DYY_NEVER_INTERACTIVE /EHsc

CC += -std=c++11 -DYY_NEVER_INTERACTIVE -fPIC -DINTERFACE_TYPES
cc += -DYY_NEVER_INTERACTIVE -fPIC -DINTERFACE_TYPES
override CC += -DYY_NEVER_INTERACTIVE -DINTERFACE_TYPES
override CXX += -DYY_NEVER_INTERACTIVE -DINTERFACE_TYPES

#################################################################################
#
Expand All @@ -42,16 +42,16 @@ INCLUDES= -I. \
-I$(MISCHOME)/include

$(ABI)/%.o: %.c
$(cc) $(INCLUDES) -c $< -o $@
$(CC) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: %.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: ../common/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: $(MISCHOME)/src/%.cc
$(CC) $(INCLUDES) -c $< -o $@
$(CXX) $(INCLUDES) -c $< -o $@

OBJS= tlmforce.o

Expand Down
9 changes: 4 additions & 5 deletions Simulink/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,18 @@ INCLUDES= -I. \

MISCHOME=../3rdParty/misc
MEX_DEBUGFLG=
CC += -fPIC -std=c++11

$(ABI)/%.o: %.c
$(cc) $(DEFINES) $(CFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@
$(CC) $(DEFINES) $(CFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: %.cc
$(CC) $(DEFINES) $(CCFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@
$(CXX) $(DEFINES) $(CXXFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: ../common/%.cc
$(CC) $(DEFINES) $(CCFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@
$(CXX) $(DEFINES) $(CXXFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@

$(ABI)/%.o: $(MISCHOME)/src/%.cc
$(CC) $(DEFINES) $(CCFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@
$(CXX) $(DEFINES) $(CXXFLAGS) -DWIN32 $(OPTFLAGS4) $(INCLUDES) -c $< -o $@

OBJS=

Expand Down
24 changes: 1 addition & 23 deletions common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ include $(MAKEFILEHEADHOME)/Makefile.head
MISCHOME = ../3rdParty/misc
TIMEHOME = ../3rdParty/rtime

TARGET_TRIPLE := $(subst -, ,$(shell $(CC) -dumpmachine))
TARGET_ARCH := $(word 1,$(TARGET_TRIPLE))
TARGET_OS := $(word 3,$(TARGET_TRIPLE))

EXTRAFLAGS =
ifeq ($TARGET_OS,mingw32)
else ifeq ($TARGET_OS,cygwin)
else
EXTRAFLAGS = -fPIC
endif

detected_OS := $(shell uname -s)
ifeq ($(detected_OS),Darwin)
EXTRAFLAGS += -DNO_RTIME
RTIMELIB =
else
RTIMELIB = -lrtime
endif

override CC += $(CFLAGS) -std=c++11 $(EXTRAFLAGS)
override CXX += $(CXXFLAGS) -std=c++11 $(EXTRAFLAGS)

SRCCLT= Plugin/PluginImplementer.cc \
Plugin/MonitoringPluginImplementer.cc \
Communication/TLMClientComm.cc \
Expand Down Expand Up @@ -185,7 +163,7 @@ $(ABI)/testapp$(FEXT): $(ABI)/TLMTestApp.o
$(LINK) $(ABI)/TLMTestApp.o -o $(ABI)/testapp$(FEXT) -L$(ABI) -lTLM $(LIBS) $(XTRLIBS) $(LIBPTHREAD)

$(ABI)/%.o: %.cc
$(CC) $(DEFINES) $(CCFLAGS) $(OPTFLAGS4) $(INCLUDES) $(INCLXML) -c $< -o $@
$(CXX) $(DEFINES) $(CXXFLAGS) $(OPTFLAGS4) $(INCLUDES) $(INCLXML) -c $< -o $@

.PHONY: clean dir depend lib manager test

Expand Down

0 comments on commit 95221c6

Please sign in to comment.