forked from emscripten-ports/regal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.regalw
170 lines (127 loc) · 4.69 KB
/
Makefile.regalw
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
158
159
160
161
162
163
164
165
166
167
168
169
170
ifndef MAKEFILE_REGALW_INCLUDED
MAKEFILE_REGALW_INCLUDED := 1
.PHONY: regalw.lib regalw.clean
include build/common.inc
include build/regal.inc
#
# Regal Wrangler
#
REGALW.STATIC ?= libRegalW.a
REGALW.SHARED ?= libRegal.so
# Static library target not yet supported
REGALW.STATIC :=
# Shared library target not currently supported for NaCL or emscripten
ifneq ($(filter nacl% emscripten%,$(SYSTEM)),)
REGALW.SHARED :=
endif
ifdef REGALW.SHARED
all:: regalw.lib
clean:: regalw.clean
REGALW.LDFLAGS := -lstdc++ -pthread -lm
REGALW.LIBS :=
REGALW.SRCS := $(REGAL.CXX)
REGALW.SRCS += src/md5/src/md5.c
REGALW.SRCS += src/jsonsl/jsonsl.c
REGALW.CFLAGS += -DREGAL_WRANGLER=1
REGALW.INCLUDE := $(REGAL.INCLUDE)
# Optional flags
ifeq ($(MODE),release)
REGALW.CFLAGS += -DNDEBUG
#REGALW.CFLAGS += -DREGAL_NO_TLS=0 # 1 for single threaded
endif
#
# Flags for custom mode
#
ifeq ($(MODE),custom)
endif
REGALW.CFLAGS += -fvisibility=hidden
REGALW.SRCS.NAMES := $(notdir $(REGALW.SRCS))
REGALW.HEADERS :=
REGALW.HEADERS += include/GL/Regal.h
REGALW.HEADERS += src/regal/RegalPrivate.h
REGALW.OBJS := $(addprefix tmp/$(SYSTEM)/regalw/static/,$(REGALW.SRCS.NAMES))
REGALW.OBJS := $(REGALW.OBJS:.c=.o)
REGALW.OBJS := $(REGALW.OBJS:.cpp=.o)
REGALW.DEPS := $(REGALW.OBJS:.o=.d)
REGALW.SOBJS := $(addprefix tmp/$(SYSTEM)/regalw/shared/,$(REGALW.SRCS.NAMES))
REGALW.SOBJS := $(REGALW.SOBJS:.c=.o)
REGALW.SOBJS := $(REGALW.SOBJS:.cpp=.o)
REGALW.SDEPS := $(LIBS.SOBJS:.o=.d)
-include $(REGALW.DEPS) $(REGALW.SDEPS)
REGALW.LIBS += $(LDFLAGS.X11)
ifneq ($(filter linux%,$(SYSTEM)),)
REGALW.SONAME := libRegalW.so.$(SO_MAJOR)
REGALW.DEVLNK := libRegalW.so
REGALW.SHARED := libRegalW.so.$(SO_VERSION)
REGALW.LDFLAGS.SO := $(LDFLAGS.SO) $(LDFLAGS.DYNAMIC) -Wl,-soname=$(REGALW.SONAME)
endif
ifneq ($(filter darwin%,$(SYSTEM)),)
REGALW.SONAME := libRegalW.$(SO_MAJOR).dylib
REGALW.DEVLNK := libRegalW.dylib
REGALW.SHARED := libRegalW.$(SO_VERSION).dylib
REGALW.FRAMEWORK := RegalWrangler
REGALW.LDFLAGS.SO := $(LDFLAGS.SO) $(LDFLAGS.DYNAMIC) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
REGALW.LDFLAGS += -Wl,-reexport-lGLU -L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries
endif
ifdef REGALW.STATIC
regalw.lib: lib/$(SYSTEM)/$(REGALW.STATIC)
endif
ifdef REGALW.SHARED
regalw.lib: lib/$(SYSTEM)/$(REGALW.SHARED)
endif
regalw.clean:
$(RM) -r tmp/$(SYSTEM)/regalw/static
$(RM) -r tmp/$(SYSTEM)/regalw/shared
ifdef REGALW.STATIC
$(RM) -r lib/$(SYSTEM)/$(REGALW.STATIC)
endif
ifdef REGALW.SHARED
$(RM) -r bin/$(SYSTEM)/$(REGALW.SHARED)
endif
lib/$(SYSTEM)/$(REGALW.STATIC): $(REGALW.OBJS)
@mkdir -p $(dir $@)
$(LOG_AR)$(CCACHE) $(AR) cr $@ $(REGALW.OBJS)
ifneq ($(RANLIB),)
$(LOG_RANLIB)$(RANLIB) $@
endif
ifneq ($(STRIP),)
$(LOG_STRIP)$(STRIP) -x $@
endif
REGALW.SHARED.DEPEND :=
ifdef REGALW.SHARED
lib/$(SYSTEM)/$(REGALW.SHARED): $(REGALW.SHARED.DEPEND) $(REGALW.SOBJS)
$(LOG_LD)$(CCACHE) $(LD) $(LDFLAGS.EXTRA) $(REGALW.LDFLAGS.SO) -o $@ $(REGALW.SOBJS) $(REGALW.SHARED.DEPEND) $(REGALW.LIBS) $(REGALW.LDFLAGS)
ifneq ($(LN),)
$(LN) $(REGALW.SHARED) lib/$(SYSTEM)/$(REGALW.SONAME)
$(LN) $(REGALW.SHARED) lib/$(SYSTEM)/$(REGALW.DEVLNK)
ifneq ($(REGALW.FRAMEWORK),)
$(LN) $(REGALW.SHARED) lib/$(SYSTEM)/$(REGALW.FRAMEWORK)
endif
endif
ifneq ($(STRIP),)
$(LOG_STRIP)$(STRIP) -x $@
endif
ifneq ($(ABIDUMP),)
$(LOG_ABIDUMP)$(ABIDUMP) $@ -o [email protected]
endif
endif
tmp/$(SYSTEM)/regalw/static/%.o: src/regal/%.cpp $(REGALW.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CXX)$(CCACHE) $(CXX) $(REGALW.CFLAGS) $(CFLAGS) $(CFLAGS.SO) $(REGALW.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalw/shared/%.o: src/regal/%.cpp $(REGALW.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CXX)$(CCACHE) $(CXX) $(REGALW.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(REGALW.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalw/static/%.o: src/md5/src/%.c $(REGALW.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CC)$(CCACHE) $(CC) $(REGALW.CFLAGS) $(CFLAGS) $(CFLAGS.SO) $(REGALW.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalw/shared/%.o: src/md5/src/%.c $(REGALW.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CC)$(CCACHE) $(CC) $(REGALW.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(REGALW.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalw/static/%.o: src/jsonsl/%.c $(REGALW.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CC)$(CCACHE) $(CC) $(REGALW.CFLAGS) $(CFLAGS) $(CFLAGS.SO) $(REGALW.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalw/shared/%.o: src/jsonsl/%.c $(REGALW.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CC)$(CCACHE) $(CC) $(REGALW.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(REGALW.INCLUDE) -o $@ -c $<
endif
endif