blob: 8a11a279d186af822a08c0eb680da6aa59f16d70 [file] [log] [blame]
Reid Spencer0fab2b12006-03-19 22:10:53 +00001##===- utils/llvm-config/Makefile --------------------------*- Makefile -*-===##
Reid Spencerf2722ca2006-03-22 15:59:55 +00002#
Reid Spencer0fab2b12006-03-19 22:10:53 +00003# The LLVM Compiler Infrastructure
4#
5# This file was developed by Reid Spencer and Eric Kidd and is distributed under
6# the University of Illinois Open Source License. See LICENSE.TXT for details.
7#
8##===----------------------------------------------------------------------===##
9
10LEVEL = ../..
11
12
13include $(LEVEL)/Makefile.common
14
Reid Spencerf2722ca2006-03-22 15:59:55 +000015# Combine preprocessor flags (except for -I) and CXX flags.
16SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
17
18# This is blank for now. We need to be careful about adding stuff here:
19# LDFLAGS tend not to be portable, and we don't currently require the
20# user to use libtool when linking against LLVM.
21SUB_LDFLAGS =
22
23# MANUAL USE ONLY! GenLibDeps.pl is very non-portable, so LibDeps.txt
24# should only be re-built manually. No other rule in this file should
25# depend on LibDeps.txt.
Reid Spencer0fab2b12006-03-19 22:10:53 +000026LibDeps.txt: $(LEVEL)/utils/GenLibDeps.pl $(LibDir)
27 $(LEVEL)/utils/GenLibDeps.pl -flat $(LibDir) | sort > LibDeps.txt
Reid Spencerf2722ca2006-03-22 15:59:55 +000028
29# Find all the cyclic dependencies between various LLVM libraries, so we
30# don't have to process them at runtime.
31FinalLibDeps.txt: find-cycles.pl # LibDeps.txt deliberately omitted.
32 $(Echo) "Finding cyclic dependencies between LLVM libraries."
33 $(Verb) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@
34
35# Rerun our configure substitutions as needed.
36llvm-config.in: llvm-config.in.in $(ConfigStatusScript)
37 $(Verb) cd $(PROJ_OBJ_ROOT) ; \
38 $(ConfigStatusScript) utils/llvm-config/llvm-config.in
39
40# Build our final script.
41llvm-config: llvm-config.in FinalLibDeps.txt
42 $(Echo) "Building llvm-config script."
43 $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' > temp.sed
44 $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed
45 $(Verb) $(ECHO) 's,@CORE_IS_ARCHIVE@,$(CORE_IS_ARCHIVE),' >> temp.sed
46 $(Verb) $(SED) -f temp.sed < $< > $@
47 $(Verb) $(RM) temp.sed
48 $(Verb) cat FinalLibDeps.txt >> $@
49 $(Verb) chmod +x llvm-config
50
51# Hook into the standard Makefile rules.
52all-local:: llvm-config
53clean-local::
54 $(Verb) $(RM) -f FinalLibDeps.txt llvm-config llvm-config.in
55install-local:: all-local
56 $(Echo) Installing llvm-config
57 $(Verb) $(MKDIR) $(PROJ_bindir)
58 $(Verb) $(ScriptInstall) llvm-config $(PROJ_bindir)