forked from Mars999/regal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.regalo
139 lines (100 loc) · 3.71 KB
/
Makefile.regalo
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
ifndef MAKEFILE_REGALO_INCLUDED
MAKEFILE_REGALO_INCLUDED := 1
.PHONY: regalo.lib regalo.clean
include build/common.inc
include build/regal.inc
include Makefile.regal
#
# Regal for OSMesa
#
REGALO.SHARED ?= libRegalO.so
# Static library target not yet supported
REGALO.STATIC :=
# Shared library target not currently supported for NaCL or emscripten
ifneq ($(filter nacl% emscripten%,$(SYSTEM)),)
REGALO.SHARED :=
endif
ifdef REGALO.SHARED
all:: regalo.lib
clean:: regalo.clean
REGALO.LDFLAGS := -lOSMesa -lstdc++ -pthread -lm -lrt
REGALO.LIBS :=
REGALO.SRCS := $(REGAL.CXX)
ifeq ($(filter nacl% emscripten%,$(SYSTEM)),)
REGALO.SRCS += src/civetweb/civetweb.c
endif
REGALO.SRCS += src/md5/src/md5.c
REGALO.SRCS += src/jsonsl/jsonsl.c
REGALO.CFLAGS += -DREGAL_SYS_OSMESA=1
REGALO.INCLUDE := $(REGAL.INCLUDE)
# Optional flags
ifeq ($(MODE),release)
REGALO.CFLAGS += -DNDEBUG
#REGALO.CFLAGS += -DREGAL_NO_TLS=0 # 1 for single threaded
endif
#
REGALO.CFLAGS += -fvisibility=hidden
REGALO.SRCS.NAMES := $(notdir $(REGALO.SRCS))
REGALO.HEADERS :=
REGALO.HEADERS += include/GL/Regal.h
REGALO.HEADERS += src/regal/RegalPrivate.h
REGALO.SOBJS := $(addprefix tmp/$(SYSTEM)/regalo/shared/,$(REGALO.SRCS.NAMES))
REGALO.SOBJS := $(REGALO.SOBJS:.c=.o)
REGALO.SOBJS := $(REGALO.SOBJS:.cpp=.o)
REGALO.SDEPS := $(LIBS.SOBJS:.o=.d)
-include $(REGALO.DEPS) $(REGALO.SDEPS)
REGALO.LIBS += $(LDFLAGS.X11)
ifneq ($(filter linux%,$(SYSTEM)),)
REGALO.SONAME := libRegalO.so.$(SO_MAJOR)
REGALO.DEVLNK := libRegalO.so
REGALO.SHARED := libRegalO.so.$(SO_VERSION)
REGALO.LDFLAGS.SO := $(LDFLAGS.SO) $(LDFLAGS.DYNAMIC) -Wl,-soname=$(REGALO.SONAME)
endif
ifneq ($(filter darwin%,$(SYSTEM)),)
REGALO.SONAME := libRegalO.$(SO_MAJOR).dylib
REGALO.DEVLNK := libRegalO.dylib
REGALO.SHARED := libRegalO.$(SO_VERSION).dylib
REGALO.FRAMEWORK := RegalO
REGALO.LDFLAGS.SO := $(LDFLAGS.SO) $(LDFLAGS.DYNAMIC) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
endif
ifdef REGALO.SHARED
regalo.lib: lib/$(SYSTEM)/$(REGALO.SHARED)
endif
regalo.clean:
$(RM) -r tmp/$(SYSTEM)/regalo/static
$(RM) -r tmp/$(SYSTEM)/regalo/shared
ifdef REGALO.SHARED
$(RM) -r bin/$(SYSTEM)/$(REGALO.SHARED)
endif
REGALO.SHARED.DEPEND :=
ifdef REGALO.SHARED
lib/$(SYSTEM)/$(REGALO.SHARED): $(REGAL.SHARED.DEPEND) $(REGALO.SOBJS)
$(LOG_LD)$(CCACHE) $(LD) $(LDFLAGS.EXTRA) $(REGALO.LDFLAGS.SO) -o $@ $(REGALO.SOBJS) $(REGAL.SHARED.DEPEND) $(REGALO.LIBS) $(REGALO.LDFLAGS)
ifneq ($(LN),)
$(LN) $(REGALO.SHARED) lib/$(SYSTEM)/$(REGALO.SONAME)
$(LN) $(REGALO.SHARED) lib/$(SYSTEM)/$(REGALO.DEVLNK)
ifneq ($(REGALO.FRAMEWORK),)
$(LN) $(REGALO.SHARED) lib/$(SYSTEM)/$(REGALO.FRAMEWORK)
endif
endif
ifneq ($(STRIP),)
$(LOG_STRIP)$(STRIP) -x $@
endif
ifneq ($(ABIDUMP),)
$(LOG_ABIDUMP)$(ABIDUMP) $@ -o [email protected]
endif
endif
tmp/$(SYSTEM)/regalo/shared/%.o: src/regal/%.cpp $(REGALO.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CXX)$(CCACHE) $(CXX) $(REGALO.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(REGALO.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalo/shared/%.o: src/civetweb/%.c $(REGALO.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CC)$(CCACHE) $(CC) $(REGALO.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(REGALO.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalo/shared/%.o: src/md5/src/%.c $(REGALO.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CC)$(CCACHE) $(CC) $(REGALO.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(REGALO.INCLUDE) -o $@ -c $<
tmp/$(SYSTEM)/regalo/shared/%.o: src/jsonsl/%.c $(REGALO.HEADERS)
@mkdir -p $(dir $@)
$(LOG_CC)$(CCACHE) $(CC) $(REGALO.CFLAGS) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(REGALO.INCLUDE) -o $@ -c $<
endif
endif