Reid Spencer | 0fab2b1 | 2006-03-19 22:10:53 +0000 | [diff] [blame] | 1 | ##===- utils/llvm-config/Makefile --------------------------*- Makefile -*-===## |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 2 | # |
Reid Spencer | 0fab2b1 | 2006-03-19 22:10:53 +0000 | [diff] [blame] | 3 | # 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 | |
| 10 | LEVEL = ../.. |
| 11 | |
| 12 | |
| 13 | include $(LEVEL)/Makefile.common |
| 14 | |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 15 | # Combine preprocessor flags (except for -I) and CXX flags. |
| 16 | SUB_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. |
| 21 | SUB_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 Spencer | 0fab2b1 | 2006-03-19 22:10:53 +0000 | [diff] [blame] | 26 | LibDeps.txt: $(LEVEL)/utils/GenLibDeps.pl $(LibDir) |
Reid Spencer | 025213e | 2006-03-23 22:42:50 +0000 | [diff] [blame^] | 27 | $(Echo) "Regenerating LibDeps.txt" |
| 28 | $(Verb) $(LLVM_SRC_ROOT)/utils/GenLibDeps.pl -flat $(LibDir) | \ |
| 29 | sort > LibDeps.txt |
Reid Spencer | f2722ca | 2006-03-22 15:59:55 +0000 | [diff] [blame] | 30 | |
| 31 | # Find all the cyclic dependencies between various LLVM libraries, so we |
| 32 | # don't have to process them at runtime. |
| 33 | FinalLibDeps.txt: find-cycles.pl # LibDeps.txt deliberately omitted. |
| 34 | $(Echo) "Finding cyclic dependencies between LLVM libraries." |
| 35 | $(Verb) $< < $(PROJ_SRC_DIR)/LibDeps.txt > $@ |
| 36 | |
| 37 | # Rerun our configure substitutions as needed. |
| 38 | llvm-config.in: llvm-config.in.in $(ConfigStatusScript) |
| 39 | $(Verb) cd $(PROJ_OBJ_ROOT) ; \ |
| 40 | $(ConfigStatusScript) utils/llvm-config/llvm-config.in |
| 41 | |
| 42 | # Build our final script. |
| 43 | llvm-config: llvm-config.in FinalLibDeps.txt |
| 44 | $(Echo) "Building llvm-config script." |
| 45 | $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' > temp.sed |
| 46 | $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed |
| 47 | $(Verb) $(ECHO) 's,@CORE_IS_ARCHIVE@,$(CORE_IS_ARCHIVE),' >> temp.sed |
| 48 | $(Verb) $(SED) -f temp.sed < $< > $@ |
| 49 | $(Verb) $(RM) temp.sed |
| 50 | $(Verb) cat FinalLibDeps.txt >> $@ |
| 51 | $(Verb) chmod +x llvm-config |
| 52 | |
| 53 | # Hook into the standard Makefile rules. |
| 54 | all-local:: llvm-config |
| 55 | clean-local:: |
| 56 | $(Verb) $(RM) -f FinalLibDeps.txt llvm-config llvm-config.in |
| 57 | install-local:: all-local |
| 58 | $(Echo) Installing llvm-config |
| 59 | $(Verb) $(MKDIR) $(PROJ_bindir) |
| 60 | $(Verb) $(ScriptInstall) llvm-config $(PROJ_bindir) |