aboutsummaryrefslogtreecommitdiffstats
path: root/erts/lib_src/Makefile.in
blob: 106e2dc983dbee5ffe19fcdbce17c8d5ab997260 (plain) (blame)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2004-2013. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# %CopyrightEnd%
#

include $(ERL_TOP)/make/output.mk
include $(ERL_TOP)/make/target.mk
include ../include/internal/$(TARGET)/ethread.mk

OMIT_OMIT_FP=no


CC=@CC@
LD=@LD@
AR=@AR@
RANLIB=@RANLIB@
MKDIR=@MKDIR@
INSTALL=@INSTALL@
INSTALL_DIR=@INSTALL_DIR@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_PROGRAM=@INSTALL_PROGRAM@

ERLANG_OSTYPE=@ERLANG_OSTYPE@

OMIT_FP=false
CFLAGS=$(subst O2,O3, @CFLAGS@)

ifeq ($(TYPE),debug)
CFLAGS=@DEBUG_CFLAGS@ -DDEBUG
TYPE_SUFFIX=.debug
ifeq ($(USING_VC),yes)
LD_FLAGS += -g
endif
PRE_LD=

else

ifeq ($(TYPE),purify)
CFLAGS=@DEBUG_CFLAGS@ -DPURIFY
TYPE_SUFFIX=.purify
PRE_LD=purify $(PURIFY_BUILD_OPTIONS)
else
ifeq ($(TYPE),quantify)
CFLAGS += -DQUANTIFY
TYPE_SUFFIX=.quantify
PRE_LD=quantify $(QUANTIFY_BUILD_OPTIONS)
else
ifeq ($(TYPE),purecov)
CFLAGS=@DEBUG_CFLAGS@ -DPURECOV
TYPE_SUFFIX=.purecov
PRE_LD=purecov $(PURECOV_BUILD_OPTIONS)
else
ifeq ($(TYPE),gcov)
CFLAGS=@DEBUG_CFLAGS@ -DGCOV -fprofile-arcs -ftest-coverage -O0
TYPE_SUFFIX=.gcov
PRE_LD=
else
ifeq ($(TYPE),valgrind)
CFLAGS=@DEBUG_CFLAGS@ -DVALGRIND
TYPE_SUFFIX=.valgrind
PRE_LD=
else
ifeq ($(TYPE),gprof)
CFLAGS += -DGPROF -pg
TYPE_SUFFIX=.gprof
PRE_LD=
else
ifeq ($(TYPE),lcnt)
TYPE_SUFFIX = .lcnt
CFLAGS += -DERTS_ENABLE_LOCK_COUNT
OMIT_FP=true
PRE_LD=
else
ifeq ($(TYPE),frmptr)
TYPE_SUFFIX = .frmptr
CFLAGS += -DERTS_FRMPTR
OMIT_OMIT_FP=yes
PRE_LD=
else
override TYPE=opt
OMIT_FP=true
TYPE_SUFFIX=
PRE_LD=
endif
endif
endif
endif
endif
endif
endif
endif
endif

OPSYS=@OPSYS@
sol2CFLAGS=
linuxCFLAGS=
darwinCFLAGS=-DDARWIN
noopsysCFLAGS=
OPSYSCFLAGS=$($(OPSYS)CFLAGS)
ARCH=@ARCH@
ultrasparcCFLAGS=-Wa,-xarch=v8plusa
ARCHCFLAGS=$($(ARCH)CFLAGS)

ifeq ($(OMIT_OMIT_FP),yes)
CFLAGS += -fno-omit-frame-pointer
OMIT_FP=false
endif

CREATE_DIRS=

ifeq ($(CC)-$(OMIT_FP), gcc-true)
CFLAGS += -fomit-frame-pointer
endif

CFLAGS += @WFLAGS@ @DEFS@ $(ARCHCFLAGS)

ifeq ($(findstring -D_GNU_SOURCE,$(CFLAGS)),)
THR_DEFS = $(ETHR_DEFS)
else
# Remove duplicate -D_GNU_SOURCE
THR_DEFS = $(filter-out -D_GNU_SOURCE%, $(ETHR_DEFS))
endif

LIBS=@LIBS@

TT_DIR=$(TARGET)/$(TYPE)

ERTS_INCL=../include
ERTS_INCL_INT=../include/internal

INCLUDES=-I$(ERTS_INCL) -I$(ERTS_INCL)/$(TARGET) -I$(ERTS_INCL_INT) -I$(ERTS_INCL_INT)/$(TARGET)
INCLUDES += -I../emulator/beam -I../emulator/sys/$(ERLANG_OSTYPE)

USING_MINGW=@MIXED_CYGWIN_MINGW@
USING_VC=@MIXED_VC@

ifeq ($(USING_VC),yes)
LIB_SUFFIX=.lib
LIB_PREFIX=
else
LIB_SUFFIX=.a
LIB_PREFIX=lib
endif

OBJS_ROOT_DIR=obj
OBJ_DIR=$(OBJS_ROOT_DIR)/$(TT_DIR)

CREATE_DIRS += $(OBJ_DIR)

ERTS_LIBS=

ifeq ($(findstring -D_GNU_SOURCE,$(CFLAGS)),)
THR_DEFS = $(ETHR_DEFS)
else
# Remove duplicate -D_GNU_SOURCE
THR_DEFS = $(filter-out -D_GNU_SOURCE%, $(ETHR_DEFS))
endif

#
# erts (public) library
#

ERTS_LIB_SRCS =	common/erl_memory_trace_parser.c

ERTS_LIB_DIR=../lib/$(TARGET)
CREATE_DIRS += $(ERTS_LIB_DIR)

ifeq ($(USING_VC),yes)
# Windows obj dir
MD_OBJ_DIR=$(OBJ_DIR)/MD
MDd_OBJ_DIR=$(OBJ_DIR)/MDd
MT_OBJ_DIR=$(OBJ_DIR)/MT
MTd_OBJ_DIR=$(OBJ_DIR)/MTd

CREATE_DIRS +=	$(MD_OBJ_DIR) \
		$(MDd_OBJ_DIR) \
		$(MT_OBJ_DIR) \
		$(MTd_OBJ_DIR)

ERTS_MD_LIB_OBJS=$(addprefix $(MD_OBJ_DIR)/,$(notdir $(ERTS_LIB_SRCS:.c=.o)))
ERTS_MDd_LIB_OBJS=$(addprefix $(MDd_OBJ_DIR)/,$(notdir $(ERTS_LIB_SRCS:.c=.o)))
ERTS_MT_LIB_OBJS=$(addprefix $(MT_OBJ_DIR)/,$(notdir $(ERTS_LIB_SRCS:.c=.o)))
ERTS_MTd_LIB_OBJS=$(addprefix $(MTd_OBJ_DIR)/,$(notdir $(ERTS_LIB_SRCS:.c=.o)))

else # --- Not windows ---

# Reentrant obj dir
ifneq ($(strip $(ETHR_LIB_NAME)),)
r_OBJ_DIR = $(OBJ_DIR)/r
CREATE_DIRS += $(r_OBJ_DIR)
ERTS_r_LIB_OBJS=$(addprefix $(r_OBJ_DIR)/,$(notdir $(ERTS_LIB_SRCS:.c=.o)))
endif
ERTS_LIB_OBJS=$(addprefix $(OBJ_DIR)/,$(notdir $(ERTS_LIB_SRCS:.c=.o)))

endif

ifeq ($(USING_VC),yes)
ERTS_MD_LIB=$(ERTS_LIB_DIR)/$(LIB_PREFIX)erts_MD$(TYPE_SUFFIX)$(LIB_SUFFIX)
ERTS_MDd_LIB=$(ERTS_LIB_DIR)/$(LIB_PREFIX)erts_MDd$(TYPE_SUFFIX)$(LIB_SUFFIX)
ERTS_MT_LIB=$(ERTS_LIB_DIR)/$(LIB_PREFIX)erts_MT$(TYPE_SUFFIX)$(LIB_SUFFIX)
ERTS_MTd_LIB=$(ERTS_LIB_DIR)/$(LIB_PREFIX)erts_MTd$(TYPE_SUFFIX)$(LIB_SUFFIX)
ERTS_LIBS += \
	$(ERTS_MD_LIB) \
	$(ERTS_MDd_LIB) \
	$(ERTS_MT_LIB) \
	$(ERTS_MTd_LIB)
else

ERTS_LIB = $(ERTS_LIB_DIR)/$(LIB_PREFIX)erts$(TYPE_SUFFIX)$(LIB_SUFFIX)
ERTS_LIBS += $(ERTS_LIB)

ifneq ($(strip $(ETHR_LIB_NAME)),)
ERTS_r_LIB = $(ERTS_LIB_DIR)/$(LIB_PREFIX)erts_r$(TYPE_SUFFIX)$(LIB_SUFFIX)
ERTS_LIBS += $(ERTS_r_LIB)
endif

endif

#
# erts_internal library
#

ERTS_LIB_INTERNAL_DIR=../lib/internal/$(TARGET)
CREATE_DIRS += $(ERTS_LIB_INTERNAL_DIR)

ERTS_INTERNAL_LIBS=

ERTS_INTERNAL_LIB_SRCS = \
	common/erl_printf_format.c \
	common/erl_printf.c \
	common/erl_misc_utils.c

ERTS_INTERNAL_LIB_NAME=erts_internal$(TYPE_SUFFIX)

ifeq ($(USING_VC),yes)
ifeq ($(TYPE),debug)
ERTS_INTERNAL_LIB_OBJS = \
	$(addprefix $(MTd_OBJ_DIR)/,$(notdir $(ERTS_INTERNAL_LIB_SRCS:.c=.o)))
else
ERTS_INTERNAL_LIB_OBJS = \
	$(addprefix $(MT_OBJ_DIR)/,$(notdir $(ERTS_INTERNAL_LIB_SRCS:.c=.o)))
endif
else
ERTS_INTERNAL_LIB_OBJS = \
	$(addprefix $(OBJ_DIR)/,$(notdir $(ERTS_INTERNAL_LIB_SRCS:.c=.o)))
endif

ERTS_INTERNAL_LIB=$(ERTS_LIB_INTERNAL_DIR)/$(LIB_PREFIX)$(ERTS_INTERNAL_LIB_NAME)$(LIB_SUFFIX)

ERTS_INTERNAL_LIBS += $(ERTS_INTERNAL_LIB)

ifneq ($(strip $(ETHR_LIB_NAME)),)
ERTS_INTERNAL_r_LIB_NAME=erts_internal_r$(TYPE_SUFFIX)

ifeq ($(USING_VC),yes)
ifeq ($(TYPE),debug)
ERTS_INTERNAL_r_LIB_OBJS = \
	$(addprefix $(MDd_OBJ_DIR)/,$(notdir $(ERTS_INTERNAL_LIB_SRCS:.c=.o)))
else
ERTS_INTERNAL_r_LIB_OBJS = \
	$(addprefix $(MD_OBJ_DIR)/,$(notdir $(ERTS_INTERNAL_LIB_SRCS:.c=.o)))
endif
else
ERTS_INTERNAL_r_LIB_OBJS = \
	$(addprefix $(r_OBJ_DIR)/,$(notdir $(ERTS_INTERNAL_LIB_SRCS:.c=.o)))
endif

ERTS_INTERNAL_r_LIB=$(ERTS_LIB_INTERNAL_DIR)/$(LIB_PREFIX)$(ERTS_INTERNAL_r_LIB_NAME)$(LIB_SUFFIX)

ERTS_INTERNAL_LIBS += $(ERTS_INTERNAL_r_LIB)

endif

#
# ethread library
#
ETHR_THR_LIB_BASE_DIR=@ETHR_THR_LIB_BASE_DIR@
ifneq ($(strip $(ETHR_LIB_NAME)),)
ETHREAD_LIB_SRC=common/ethr_aux.c \
		common/ethr_atomics.c \
		common/ethr_mutex.c \
		common/ethr_cbf.c \
		$(ETHR_THR_LIB_BASE_DIR)/ethread.c \
		$(ETHR_THR_LIB_BASE_DIR)/ethr_event.c
ETHR_X86_SSE2_ASM=@ETHR_X86_SSE2_ASM@
ifeq ($(ETHR_X86_SSE2_ASM),yes)
ETHREAD_LIB_SRC += pthread/ethr_x86_sse2_asm.c
endif
ETHREAD_LIB_NAME=ethread$(TYPE_SUFFIX)

ifeq ($(USING_VC),yes)
ifeq ($(TYPE),debug)
ETHREAD_LIB_OBJS = \
	$(addprefix $(MDd_OBJ_DIR)/,$(notdir $(ETHREAD_LIB_SRC:.c=.o)))
else
ETHREAD_LIB_OBJS = \
	$(addprefix $(MD_OBJ_DIR)/,$(notdir $(ETHREAD_LIB_SRC:.c=.o)))
endif
else
ETHREAD_LIB_OBJS = \
	$(addprefix $(r_OBJ_DIR)/,$(notdir $(ETHREAD_LIB_SRC:.c=.o)))
endif

ETHREAD_LIB=$(ERTS_LIB_INTERNAL_DIR)/$(LIB_PREFIX)$(ETHREAD_LIB_NAME)$(LIB_SUFFIX)

else

ETHREAD_LIB_SRC=
ETHREAD_LIB_NAME=
ETHREAD_LIB_OBJS=
ETHREAD_LIB=

endif

_create_dirs := $(shell mkdir -p $(CREATE_DIRS))
#
# Everything to build
#
.PHONY: all
all: $(OBJ_DIR)/MADE

$(OBJ_DIR)/MADE: $(ETHREAD_LIB) $(ERTS_LIBS) $(ERTS_INTERNAL_LIBS)
	$(gen_verbose)
ifeq ($(OMIT_OMIT_FP),yes)
	@echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *'
	@echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *'
	@echo '* *                                                         * *'
	@echo '* * NOTE: Omit frame pointer optimization has been omitted  * *'
	@echo '* *                                                         * *'
	@echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *'
	@echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *'
endif
	$(V_at)echo $? > $(OBJ_DIR)/MADE

#
# The libs ...
#
ifeq ($(USING_VC),yes)
AR_OUT=-out:
AR_FLAGS=
else
AR_OUT=
ifeq ($(V),0)
AR_FLAGS=rc
else
AR_FLAGS=rcv
endif
endif

ifndef RANLIB
RANLIB=true
endif

$(ETHREAD_LIB): $(ETHREAD_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ETHREAD_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_INTERNAL_LIB): $(ERTS_INTERNAL_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_INTERNAL_r_LIB): $(ERTS_INTERNAL_r_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_r_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_MD_LIB): $(ERTS_MD_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MD_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_MDd_LIB): $(ERTS_MDd_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MDd_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_MT_LIB): $(ERTS_MT_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MT_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_MTd_LIB): $(ERTS_MTd_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MTd_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_r_LIB): $(ERTS_r_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_r_LIB_OBJS)
	$(V_RANLIB) $@

$(ERTS_LIB): $(ERTS_LIB_OBJS)
	$(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_LIB_OBJS)
	$(V_RANLIB) $@

#
# Object files
#

$(r_OBJ_DIR)/ethr_x86_sse2_asm.o: pthread/ethr_x86_sse2_asm.c
	$(V_CC) -msse2 $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(r_OBJ_DIR)/%.o: common/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(r_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/%.o: common/%.c
	$(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c
	$(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# Win32 specific

$(MD_OBJ_DIR)/%.o: common/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@

$(MD_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@

$(MDd_OBJ_DIR)/%.o: common/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@

$(MDd_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@

$(MT_OBJ_DIR)/%.o: common/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@

$(MT_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@

$(MTd_OBJ_DIR)/%.o: common/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@

$(MTd_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c
	$(V_CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@

#
# Install
#

include $(ERL_TOP)/make/otp_release_targets.mk
include ../vsn.mk
RELSYSDIR = $(RELEASE_PATH)/erts-$(VSN)

RELEASE_INCLUDES= \
	$(ERTS_INCL)/erl_memory_trace_parser.h \
	$(ERTS_INCL)/$(TARGET)/erl_int_sizes_config.h \
	$(ERTS_INCL)/$(TARGET)/erl_native_features_config.h \
	$(ERTS_INCL)/erl_fixed_size_int_types.h
RELEASE_LIBS=$(ERTS_LIBS)

INTERNAL_RELEASE_INCLUDES= \
	$(ERTS_INCL_INT)/README \
	$(ERTS_INCL_INT)/ethread.h \
	$(ERTS_INCL_INT)/ethread_inline.h \
	$(ERTS_INCL_INT)/ethr_mutex.h \
	$(ERTS_INCL_INT)/ethr_optimized_fallbacks.h \
	$(ERTS_INCL_INT)/ethr_atomics.h \
	$(ERTS_INCL_INT)/$(TARGET)/ethread.mk \
	$(ERTS_INCL_INT)/$(TARGET)/erts_internal.mk \
	$(ERTS_INCL_INT)/$(TARGET)/ethread_header_config.h \
	$(ERTS_INCL_INT)/erl_printf.h \
	$(ERTS_INCL_INT)/erl_printf_format.h \
	$(ERTS_INCL_INT)/erl_memory_trace_protocol.h \
	$(ERTS_INCL_INT)/erl_misc_utils.h \
	$(ERTS_INCL_INT)/erl_errno.h

INTERNAL_X_RELEASE_INCLUDE_DIRS= \
        i386 x86_64 ppc32 sparc32 sparc64 tile gcc pthread win libatomic_ops

INTERNAL_RELEASE_LIBS= \
	../lib/internal/README \
	$(ETHREAD_LIB) \
	$(ERTS_INTERNAL_LIBS)

.PHONY: release_spec
release_spec: all
ifneq ($(strip $(RELEASE_INCLUDES)),)
	$(INSTALL_DIR) "$(RELSYSDIR)/include"
	$(INSTALL_DIR) "$(RELEASE_PATH)/usr/include"
	$(INSTALL_DATA) $(RELEASE_INCLUDES) "$(RELSYSDIR)/include"
	$(INSTALL_DATA) $(RELEASE_INCLUDES) "$(RELEASE_PATH)/usr/include"
endif
ifneq ($(strip $(INTERNAL_RELEASE_INCLUDES)),)
	$(INSTALL_DIR) "$(RELSYSDIR)/include/internal"
	$(INSTALL_DATA) $(INTERNAL_RELEASE_INCLUDES) "$(RELSYSDIR)/include/internal"
endif
ifneq ($(strip $(INTERNAL_X_RELEASE_INCLUDE_DIRS)),)
	for xdir in $(INTERNAL_X_RELEASE_INCLUDE_DIRS); do \
		$(INSTALL_DIR) "$(RELSYSDIR)/include/internal/$$xdir"; \
		$(INSTALL_DATA) $(ERTS_INCL_INT)/$$xdir/*.h \
			"$(RELSYSDIR)/include/internal/$$xdir"; \
	done
endif
ifneq ($(strip $(RELEASE_LIBS)),)
	$(INSTALL_DIR) "$(RELSYSDIR)/lib"
	$(INSTALL_DIR) "$(RELEASE_PATH)/usr/lib"
	$(INSTALL_DATA) $(RELEASE_LIBS) "$(RELSYSDIR)/lib"
	$(INSTALL_DATA) $(RELEASE_LIBS) "$(RELEASE_PATH)/usr/lib"
endif
ifneq ($(strip $(INTERNAL_RELEASE_LIBS)),)
	$(INSTALL_DIR) "$(RELSYSDIR)/lib/internal"
	$(INSTALL_DATA) $(INTERNAL_RELEASE_LIBS) "$(RELSYSDIR)/lib/internal"
endif

.PHONY: docs
docs: 

.PHONY: release_docs_spec
release_docs_spec:

#
# Cleanup
#
.PHONY: clean
clean:
	$(RM) -r ../lib/internal/$(TARGET)/*
	$(RM) -r ../lib/$(TARGET)/*
	$(RM) -r obj/$(TARGET)/*

#
# Make dependencies
#

ifeq ($(USING_VC),yes)
# VC++ used for compiling. We undef __GNUC__ since if __GNUC__ is defined
# we will include other headers than when compiling which will result in
# faulty dependencies.
#DEP_CC=@EMU_CC@ -U__GNUC__
DEP_CC=$(CC)
else
DEP_CC=$(CC)
endif

#SED_REPL_WIN_DRIVE=s|\([ 	]\)\([A-Za-z]\):|\1/cygdrive/\2|g;s|^\([A-Za-z]\):|/cygdrive/\1|g
SED_REPL_O=s|^\([^:]*\)\.o:|$$(OBJ_DIR)/\1.o:|g
SED_REPL_r_O=s|^\([^:]*\)\.o:|$$(r_OBJ_DIR)/\1.o:|g
SED_REPL_MD_O=s|^\([^:]*\)\.o:|$$(MD_OBJ_DIR)/\1.o:|g
SED_REPL_MDd_O=s|^\([^:]*\)\.o:|$$(MDd_OBJ_DIR)/\1.o:|g
SED_REPL_MT_O=s|^\([^:]*\)\.o:|$$(MT_OBJ_DIR)/\1.o:|g
SED_REPL_MTd_O=s|^\([^:]*\)\.o:|$$(MTd_OBJ_DIR)/\1.o:|g
SED_REPL_TT_DIR=s|$(TT_DIR)/|$$(TT_DIR)/|g
SED_REPL_TARGET=s|$(TARGET)/|$$(TARGET)/|g

ifeq ($(TARGET),win32)
#SED_PREFIX=$(SED_REPL_WIN_DRIVE);
SED_PREFIX=
DEP_FLAGS=$(subst -O3,,$(subst -O2,,$(CFLAGS))) $(INCLUDES)
else
SED_PREFIX=
DEP_FLAGS=$(CFLAGS) $(INCLUDES)
endif

SED_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'
SED_r_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_r_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'
SED_MD_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_MD_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'
SED_MDd_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_MDd_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'
SED_MT_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_MT_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'
SED_MTd_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_MTd_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'

DEPEND_MK=$(OBJ_DIR)/depend.mk

.PHONY: depend
depend: $(DEPEND_MK)
$(DEPEND_MK):
	$(gen_verbose)
	$(V_colon)@echo "Generating dependency file $(DEPEND_MK)..."
	@echo "# Generated dependency rules" > $(DEPEND_MK);
	@echo "# " >> $(DEPEND_MK);
ifneq ($(strip $(ETHREAD_LIB_SRC)),)
	@echo "# ethread lib objects..." >> $(DEPEND_MK);
ifeq ($(USING_VC),yes)
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \
		| $(SED_MD_DEPEND) >> $(DEPEND_MK)
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \
		| $(SED_MDd_DEPEND) >> $(DEPEND_MK)
else
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \
		| $(SED_r_DEPEND) >> $(DEPEND_MK)
endif
endif
ifneq ($(strip $(ERTS_INTERNAL_LIB_SRCS)),)
ifneq ($(strip $(ETHREAD_LIB_SRC)),)
	@echo "# erts_internal_r lib objects..." >> $(DEPEND_MK);
ifeq ($(USING_VC),yes)
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_MD_DEPEND) >> $(DEPEND_MK)
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_MDd_DEPEND) >> $(DEPEND_MK)
else
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_r_DEPEND) >> $(DEPEND_MK)
endif
endif
	@echo "# erts_internal lib objects..." >> $(DEPEND_MK);
ifeq ($(USING_VC),yes)
	$(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_MD_DEPEND) >> $(DEPEND_MK)
	$(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_MDd_DEPEND) >> $(DEPEND_MK)
else
	$(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_DEPEND) >> $(DEPEND_MK)
endif
endif
ifneq ($(strip $(ERTS_LIB_SRCS)),)
ifeq ($(USING_VC),yes)
	@echo "# erts_MD lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \
		| $(SED_MD_DEPEND) >> $(DEPEND_MK)
	@echo "# erts_MDd lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \
		| $(SED_MDd_DEPEND) >> $(DEPEND_MK)
	@echo "# erts_MT lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \
		| $(SED_MT_DEPEND) >> $(DEPEND_MK)
	@echo "# erts_MTd lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \
		| $(SED_MTd_DEPEND) >> $(DEPEND_MK)
	@echo "# erts_internal_r lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_MD_DEPEND) >> $(DEPEND_MK)
	@echo "# erts_internal_r.debug lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \
		| $(SED_MDd_DEPEND) >> $(DEPEND_MK)
else
ifneq ($(strip $(ETHREAD_LIB_SRC)),)
	@echo "# erts_r lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \
		| $(SED_r_DEPEND) >> $(DEPEND_MK)
endif
	@echo "# erts lib objects..." >> $(DEPEND_MK);
	$(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_LIB_SRCS) \
		| $(SED_DEPEND) >> $(DEPEND_MK)
endif
endif
	@echo "# EOF" >> $(DEPEND_MK);

ifneq ($(MAKECMDGOALS),clean)
-include $(DEPEND_MK)
endif

# eof