comparison druntime/src/common/posix.mak @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 # Makefile to build the D runtime library core components for Posix
2 # Designed to work with GNU make
3 # Targets:
4 # make
5 # Same as make all
6 # make debug
7 # Build the debug version of the library
8 # make release
9 # Build the release version of the library
10 # make doc
11 # Generate documentation
12 # make clean
13 # Delete all files created by build process
14
15 # Essentials
16
17 LIBDIR=../../lib
18 DOCDIR=../../doc
19 IMPDIR=../../import
20 LIBBASENAME=libdruntime-core.a
21 MODULES=bitop exception memory runtime thread vararg \
22 $(addprefix sync/,barrier condition config exception mutex rwmutex semaphore)
23 BUILDS=debug release unittest
24
25 # Symbols
26
27 DMD=dmd
28 CLC=ar rsv
29 DOCFLAGS=-version=DDoc
30 DFLAGS_release=-d -release -O -inline -w
31 DFLAGS_debug=-d -g -w
32 DFLAGS_unittest=$(DFLAGS_release) -unittest
33 CFLAGS_release= -O
34 CFLAGS_debug= -g
35 CFLAGS_unittest=$(CFLAGS_release)
36
37 # Derived symbols
38
39 C_SRCS=core/stdc/errno.c #core/threadasm.S
40 C_OBJS=errno.o threadasm.o
41 AS_OBJS=$(addsuffix .o,$(basename $(AS_SRCS)))
42 D_SRCS=$(addsuffix .d,$(addprefix core/,$(MODULES))) \
43 $(addsuffix .d,$(addprefix $(IMPDIR)/core/stdc/,math stdarg stdio wchar_)) \
44 $(addsuffix .d,$(addprefix $(IMPDIR)/core/sys/posix/,netinet/in_ sys/select sys/socket sys/stat sys/wait))
45 ALL_OBJS_O=$(addsuffix .o,$(addprefix core/,$(MODULES))) \
46 $(addsuffix .o,$(addprefix $(IMPDIR)/core/stdc/,math stdarg stdio wchar_)) \
47 $(addsuffix .o,$(addprefix $(IMPDIR)/core/sys/posix/,netinet/in_ sys/select sys/socket sys/stat sys/wait)) \
48 $(AS_OBJS) $(C_OBJS)
49 DOCS=$(addsuffix .html,$(addprefix $(DOCDIR)/core/,$(MODULES)))
50 IMPORTS=$(addsuffix .di,$(addprefix $(IMPDIR)/core/,$(MODULES)))
51 ALLLIBS=$(addsuffix /$(LIBBASENAME),$(addprefix $(LIBDIR)/,$(BUILDS)))
52
53 # Patterns
54
55 $(LIBDIR)/%/$(LIBBASENAME) : $(D_SRCS) $(C_SRCS)
56 $(CC) -c $(CFLAGS_$*) $(C_SRCS)
57 ifeq ($(DMD),ldc2 -vv)
58 $(DMD) $(DFLAGS_$*) -of$@ $(D_SRCS)
59 $(CLC) $@ $(ALL_OBJS_O)
60 else
61 $(DMD) $(DFLAGS_$*) -lib -of$@ $(D_SRCS) $(C_OBJS)
62 endif
63 rm $(C_OBJS)
64
65 $(DOCDIR)/%.html : %.d
66 $(DMD) -c -d -o- -Df$@ $<
67
68 $(IMPDIR)/%.di : %.d
69 $(DMD) -c -d -o- -Hf$@ $<
70
71 # Rulez
72
73 all : $(BUILDS) doc
74
75 debug : $(LIBDIR)/debug/$(LIBBASENAME) $(IMPORTS)
76 release : $(LIBDIR)/release/$(LIBBASENAME) $(IMPORTS)
77 unittest : $(LIBDIR)/unittest/$(LIBBASENAME) $(IMPORTS)
78 doc : $(DOCS)
79
80 clean :
81 rm -f $(IMPORTS) $(DOCS) $(ALLLIBS)