Use the FAKE_SOURCES feature for proper distribution of contents
[oota-llvm.git] / runtime / GCCLibraries / crtend / Makefile
1 ##===- runtime/GCCLibraries/crtend/Makefile ----------------*- Makefile -*-===##
2
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
7
8 ##===----------------------------------------------------------------------===##
9 #
10 # This directory contains the C and C++ runtime libraries for the LLVM GCC
11 # front-ends.  See the README.txt file for more details.
12 #
13 # Since this archive has strange requirements, we use some custom rules for 
14 # building it.
15 #
16 ##===----------------------------------------------------------------------===##
17
18 LEVEL = ../../..
19 DONT_BUILD_RELINKED = 1
20 BYTECODE_LIBRARY = 1
21 LIBRARYNAME = crtend
22
23 # Note: We're using FAKE_SOURCES because the comp_*.c don't really exists. 
24 # However this makefile builds comp_*.bc and that's what we want in the library.
25 # The FAKE_SOURCES variable supports this kind of construction. It uses the
26 # FAKE_SOURCES to determine a list of things to build, but doesn't use 
27 # FAKE_SOURCES for dependencies, distribution, etc. It is assumed the makefile
28 # will know how to build the objects eventhough the sources don't exist.
29
30 FAKE_SOURCES := comp_main.c comp_genericeh.c comp_sjljeh.c
31
32 MainSrc      := crtend.c listend.ll
33 GenericEHSrc := Exception.cpp
34 SJLJEHSrc    := SJLJ-Exception.cpp
35
36 EXTRA_DIST   := $(MainSrc) $(GenericEHSrc) $(SJLJEHSrc) \
37                 comp_main.lst comp_genericeh.lst comp_sjljeh.lst
38
39 include $(LEVEL)/Makefile.common
40
41 MainObj      := $(ObjDir)/crtend.bc $(ObjDir)/listend.bc
42 GenericEHObj := $(ObjDir)/Exception.bc
43 SJLJEHObj    := $(ObjDir)/SJLJ-Exception.bc
44
45 # __main and ctor/dtor support component
46 $(ObjDir)/comp_main.bc: $(MainObj)
47         $(Echo) Linking $(notdir $@) component...
48         $(Verb) $(GCCLD) -link-as-library \
49         -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_main.lst \
50         $(MainObj) -o $@ \
51
52 # Generic exception handling support runtime.
53 $(ObjDir)/comp_genericeh.bc: $(GenericEHObj)
54         $(Echo) Linking $(notdir $@) component...
55         $(Verb) $(GCCLD) -link-as-library \
56         -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_genericeh.lst \
57         $(GenericEHObj) -o $@
58
59 # setjmp/longjmp exception handling support runtime.
60 $(ObjDir)/comp_sjljeh.bc: $(SJLJEHObj)
61         $(Echo) Linking $(notdir $@) component...
62         $(Verb) $(GCCLD) -link-as-library \
63         -internalize-public-api-file=$(BUILD_SRC_DIR)/comp_sjljeh.lst \
64         $(SJLJEHObj) -o $@