blob: 81a01034c9de7deb46d22ffab2c6de9fddcbd398 [file] [log] [blame]
Reid Spencer05dee502006-04-20 21:13:58 +00001##===- tools/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
Reid Spencerb195d9d2006-03-23 23:21:29 +000012EXTRA_DIST = LibDeps.txt llvm-config.in.in find-cycles.pl
Reid Spencer0fab2b12006-03-19 22:10:53 +000013
14include $(LEVEL)/Makefile.common
15
Reid Spencerf2722ca2006-03-22 15:59:55 +000016# Combine preprocessor flags (except for -I) and CXX flags.
17SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
18
19# This is blank for now. We need to be careful about adding stuff here:
20# LDFLAGS tend not to be portable, and we don't currently require the
21# user to use libtool when linking against LLVM.
22SUB_LDFLAGS =
23
Reid Spencer05dee502006-04-20 21:13:58 +000024FinalLibDeps = $(PROJ_SRC_DIR)/FinalLibDeps.txt
25ifdef HAVE_PERL
26ifeq ($(HAVE_PERL),1)
27LibDeps = $(PROJ_SRC_DIR)/LibDeps.txt
28GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl
Reid Spencerf2722ca2006-03-22 15:59:55 +000029# MANUAL USE ONLY! GenLibDeps.pl is very non-portable, so LibDeps.txt
30# should only be re-built manually. No other rule in this file should
31# depend on LibDeps.txt.
Reid Spencer05dee502006-04-20 21:13:58 +000032$(LibDeps): $(GenLibDeps) $(LibDir)
Reid Spencer025213e2006-03-23 22:42:50 +000033 $(Echo) "Regenerating LibDeps.txt"
Reid Spencer05dee502006-04-20 21:13:58 +000034 $(Verb) $(GenLibDeps) -flat $(LibDir) | sort > $(LibDeps)
Reid Spencerf2722ca2006-03-22 15:59:55 +000035
36# Find all the cyclic dependencies between various LLVM libraries, so we
37# don't have to process them at runtime.
Reid Spencer05dee502006-04-20 21:13:58 +000038$(FinalLibDeps): find-cycles.pl $(LibDeps)
Reid Spencerf2722ca2006-03-22 15:59:55 +000039 $(Echo) "Finding cyclic dependencies between LLVM libraries."
Reid Spencerb195d9d2006-03-23 23:21:29 +000040 $(Verb) $(PERL) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@
Reid Spencer05dee502006-04-20 21:13:58 +000041endif
42endif
Reid Spencerf2722ca2006-03-22 15:59:55 +000043
44# Rerun our configure substitutions as needed.
Reid Spencer05dee502006-04-20 21:13:58 +000045ConfigInIn = $(PROJ_SRC_DIR)/llvm-config.in.in
46llvm-config.in: $(ConfigInIn) $(ConfigStatusScript)
Reid Spencerf2722ca2006-03-22 15:59:55 +000047 $(Verb) cd $(PROJ_OBJ_ROOT) ; \
Reid Spencer05dee502006-04-20 21:13:58 +000048 $(ConfigStatusScript) tools/llvm-config/llvm-config.in
Reid Spencerf2722ca2006-03-22 15:59:55 +000049
50# Build our final script.
Reid Spencer05dee502006-04-20 21:13:58 +000051llvm-config: llvm-config.in $(FinalLibDeps)
Reid Spencerf2722ca2006-03-22 15:59:55 +000052 $(Echo) "Building llvm-config script."
53 $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' > temp.sed
54 $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed
55 $(Verb) $(ECHO) 's,@CORE_IS_ARCHIVE@,$(CORE_IS_ARCHIVE),' >> temp.sed
56 $(Verb) $(SED) -f temp.sed < $< > $@
57 $(Verb) $(RM) temp.sed
Reid Spencer05dee502006-04-20 21:13:58 +000058 $(Verb) cat $(FinalLibDeps) >> $@
Reid Spencerf2722ca2006-03-22 15:59:55 +000059 $(Verb) chmod +x llvm-config
60
61# Hook into the standard Makefile rules.
62all-local:: llvm-config
63clean-local::
Reid Spencer05dee502006-04-20 21:13:58 +000064 $(Verb) $(RM) -f llvm-config llvm-config.in
Reid Spencerf2722ca2006-03-22 15:59:55 +000065install-local:: all-local
66 $(Echo) Installing llvm-config
67 $(Verb) $(MKDIR) $(PROJ_bindir)
68 $(Verb) $(ScriptInstall) llvm-config $(PROJ_bindir)