-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile.head
157 lines (140 loc) · 4.78 KB
/
Makefile.head
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Default Makefile.head
# This file typically sets up the compiler and includes for the specific platform
# Here we simply assume gcc and some GNU/Linux environment
ifeq ($(ABI),)
# We need some machine environment
$(error Please set the ABI environment variable, typical choices are: WINDOWS32, WINDOWS64, or LINUX64)
endif
ifeq ($(OMDEV),)
OMDEV = $(OPENMODELICAHOME)
endif
detected_OS ?= $(shell uname -s)
ifeq ($(ABI),WINDOWS64)
ifeq (MINGW64,$(findstring MINGW64,$(detected_OS)))
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
FEXT=.exe
SHREXT=.dll
STAEXT=.a
OMDEVDIR ?= $(shell cygpath $$OMDEV)
MSYSROOT ?= $(OMDEVDIR)/tools/msys
CMAKE ?= $(MSYSROOT)/bin/cmake/bin/cmake
CMAKE_TARGET ?= -G "MSYS Makefiles"
INSTALL_DIR = install/mingw
else
CC=mycl cl64 /DMSC_VER /DWIN32 /D_WIN32 /EHsc /DNOMINMAX /GR
cc=mycl cl64
LINK=mycl link64
AR=ar
CP=cp
FEXT=.exe
INSTALL_DIR = install/mingw
endif
else ifeq ($(ABI),WINDOWS32)
ifeq (MINGW32,$(findstring MINGW32,$(detected_OS)))
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
FEXT=.exe
SHREXT=.dll
STAEXT=.a
OMDEVDIR ?= $(shell cygpath $$OMDEV)
MSYSROOT ?= $(OMDEVDIR)/tools/msys
CMAKE ?= $(MSYSROOT)/bin/cmake/bin/cmake
CMAKE_TARGET ?= -G "MSYS Makefiles"
INSTALL_DIR = install/mingw
else
$(error No compiler found to build for WINDOWS32)
endif
else ifeq ($(ABI),MAC64)
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
SHREXT=.dylib
STAEXT=.a
CMAKE=cmake
CMAKE_TARGET="-G Unix Makefiles"
INSTALL_DIR = install/mac
else
CC=gcc
CXX=g++
LINK=$(CXX)
AR=ar
CP=cp
SHREXT=.so
STAEXT=.a
CMAKE=cmake
CMAKE_TARGET="-GUnix Makefiles"
INSTALL_DIR = install/linux
endif
MISCHOME=$(UP)/extralibs/misc
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 ($(ABI),WINDOWS32)
else ifeq ($(ABI),WINDOWS64)
else
EXTRAFLAGS = -fPIC
endif
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,$(detected_OS)))
INCLXML-WINDOWS64=-I$(MSYSROOT)/mingw64/include/libxml2 -I$(MSYSROOT)/mingw64/include/
LIBXML-WINDOWS64=-L$(MSYSROOT)/mingw64/lib -Wl,-Bstatic -lxml2 -lz -llzma -liconv -lws2_32 -Wl,-Bdynamic -static-libgcc -static-libstdc++
CP-LIBXML-WINDOWS64=cp $(MSYSROOT)/mingw64/bin/libxml2-2.dll $(MSYSROOT)/mingw64/bin/libiconv-2.dll $(MSYSROOT)/mingw64/bin/zlib1.dll $(MSYSROOT)/mingw64/bin/libwinpthread-1.dll $(MSYSROOT)/mingw64/bin/libstdc++-6.dll $(MSYSROOT)/mingw64/bin/libgcc_s_seh-1.dll $(MSYSROOT)/mingw64/bin/liblzma-5.dll $(UP)/bin
INCLPTHREAD-WINDOWS64=
LIBPTHREAD-WINDOWS64=-Wl,-Bstatic -lpthread -Wl,-Bdynamic
XTRLIBS-WINDOWS64=-lws2_32
else
INCLXML-WINDOWS64=-I$(UP)/extralibs/libxml2/include
LIBXML-WINDOWS64=-L$(UP)/extralibs/libxml2/$(ABI)/lib libxml2.lib
CP-LIBXML-WINDOWS64=
XTRLIBS-WINDOWS64=user32.lib shell32.lib ws2_32.lib Gdi32.lib pthreadVC2.lib
INCLPTHREAD-WINDOWS64=-I$(UP)/extralibs/pthread/include
LIBPTHREAD-WINDOWS64=-L$(UP)/extralibs/pthread/$(ABI)/lib pthreadVC2.lib
endif
INCLXML-WINDOWS32=-I$(MSYSROOT)/mingw32/include/libxml2 -I$(MSYSROOT)/mingw32/include/
LIBXML-WINDOWS32=-L$(MSYSROOT)/mingw32/lib -Wl,-Bstatic -lxml2 -lz -llzma -liconv -lws2_32 -Wl,-Bdynamic -static-libgcc -static-libstdc++
CP-LIBXML-WINDOWS32=cp $(MSYSROOT)/mingw32/bin/libxml2-2.dll $(MSYSROOT)/mingw32/bin/libiconv-2.dll $(MSYSROOT)/mingw32/bin/zlib1.dll $(MSYSROOT)/mingw32/bin/libwinpthread-1.dll $(MSYSROOT)/mingw32/bin/libstdc++-6.dll $(MSYSROOT)/mingw32/bin/libgcc_s_dw2-1.dll $(MSYSROOT)/mingw32/bin/liblzma-5.dll $(UP)/bin
INCLPTHREAD-WINDOWS32=
LIBPTHREAD-WINDOWS32=-Wl,-Bstatic -lpthread -Wl,-Bdynamic
XTRLIBS-WINDOWS32=-lws2_32
INCLXML-LINUX64=-I$(UP)/../3rdParty/libxml2/install/linux/include/libxml2
LIBXML-LINUX64=-L$(UP)/../3rdParty/libxml2/install/linux/lib -lxml2
CP-LIBXML-LINUX64=
XTRLIBS-LINUX64=-lrt
LIBPTHREAD-LINUX64=-L$(UP)/extralibs/pthread/$(ABI)/lib -lpthread
INCLXML-LINUX32=-I$(UP)/../3rdParty/libxml2/install/linux/include/libxml2
LIBXML-LINUX32=-L$(UP)/../3rdParty/libxml2/install/linux/lib -lxml2
CP-LIBXML-LINUX32=
XTRLIBS-LINUX32=-lrt
LIBPTHREAD-LINUX32=-L$(UP)/extralibs/pthread/$(ABI)/lib -lpthread
INCLXML-MAC64=-I/usr/include/libxml2
LIBXML-MAC64=-lxml2
CP-LIBXML-MAC64=
XTRLIBS-MAC64=
LIBPTHREAD-MAC64=-L$(UP)/extralibs/pthread/$(ABI)/lib -lpthread
INCLXML=$(INCLXML-$(ABI))
LIBXML=$(LIBXML-$(ABI))
CP-LIBXML=$(CP-LIBXML-$(ABI))
XTRLIBS=$(XTRLIBS-$(ABI))
INCLPTHREAD=$(INCLPTHREAD-$(ABI))
LIBPTHREAD=$(LIBPTHREAD-$(ABI))
MEX=mex