Changeset 189 for trunk/kBuild/footer.kmk
- Timestamp:
- Dec 14, 2004, 6:36:58 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/footer.kmk
r185 r189 4 4 # kBuild - File included at top of makefile. 5 5 # 6 # Copyright (c) source004 knut st. osmundsen <bird-srcspam@anduin.net>6 # Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 # 8 8 # … … 35 35 # all targets. 36 36 ALL_TARGETS := \ 37 $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) \ 38 $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) \ 39 $(DLLS) $(DLLS.$(BUILD_TARGET)) \ 40 $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) \ 41 $(OTHERS) $(OTHERS.$(BUILD_TARGET)) 37 $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) \ 38 $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) \ 39 $(DLLS) $(DLLS.$(BUILD_TARGET)) \ 40 $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) \ 41 $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) \ 42 $(OTHERS) $(OTHERS.$(BUILD_TARGET)) 42 43 43 44 # dependency files. … … 56 57 _SYSMODS:= 57 58 _DIRS := 59 _IMPORT_LIBS := 58 60 59 61 # all objs of a specific target … … 719 721 720 722 # 723 # DLLS 724 # 725 726 ## DLL (one). 727 # @param $(target) Normalized target (program) name. 728 define def_dll 729 # dllmod basics 730 $(eval tool := $(call _TARGET_TOOL,$(target),LD)) 731 $(eval outbase := $(call _TARGET_BASE,$(target),$(target))) 732 $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))) 733 $(eval dllsuff := $(firstword $($(target)_DLLSUFF) $($(target)_DLLSUFF) $(TOOL_$(tool)_LDDLLSUFF) $(SUFF_DLL))) 734 $(eval dll := $(outbase)$(dllsuff)) 735 $(eval TARGET_$(target) := $(dll)) 736 737 # source -> object 738 $(eval $(def_target_sources)) 739 740 # dllmod linking. 741 $(eval tool := $(call _TARGET_TOOL,$(target),LD)) 742 $(eval outbase := $(call _TARGET_BASE,$(target),$(target))) 743 $(eval objs = $(_OBJS_$(target))) 744 $(eval flags :=\ 745 $(TOOL_$(tool)_LDFLAGS)\ 746 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\ 747 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\ 748 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\ 749 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\ 750 $(LDFLAGS)\ 751 $(LDFLAGS.$(BUILD_TYPE))\ 752 $(LDFLAGS.$(BUILD_TARGET))\ 753 $(LDFLAGS.$(BUILD_TARGET_ARCH))\ 754 $(LDFLAGS.$(BUILD_TARGET_CPU))\ 755 $($(target)_LDFLAGS)\ 756 $($(target)_LDFLAGS.$(BUILD_TYPE))\ 757 $($(target)_LDFLAGS.$(BUILD_TARGET))\ 758 $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\ 759 $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\ 760 ) 761 $(eval libs :=\ 762 $($(target)_LIBS.$(BUILD_TARGET_CPU))\ 763 $($(target)_LIBS.$(BUILD_TARGET_ARCH))\ 764 $($(target)_LIBS.$(BUILD_TARGET))\ 765 $($(target)_LIBS.$(BUILD_TYPE))\ 766 $($(target)_LIBS)\ 767 $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \ 768 $($(target)_SDKS.$(BUILD_TYPE)) \ 769 $($(target)_SDKS),\ 770 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\ 771 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\ 772 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\ 773 $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\ 774 $(SDK_$(sdk)_LIBS))\ 775 $(LIBS.$(BUILD_TARGET_CPU))\ 776 $(LIBS.$(BUILD_TARGET_ARCH))\ 777 $(LIBS.$(BUILD_TARGET))\ 778 $(LIBS.$(BUILD_TYPE))\ 779 $(LIBS)\ 780 $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \ 781 $(SDKS.$(BUILD_TYPE)) \ 782 $(SDKS),\ 783 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\ 784 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\ 785 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\ 786 $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\ 787 $(SDK_$(sdk)_LIBS))\ 788 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\ 789 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\ 790 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\ 791 $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\ 792 $(TOOL_$(tool)_LIBS)\ 793 ) 794 $(eval libpath :=\ 795 $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\ 796 $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\ 797 $($(target)_LIBPATH.$(BUILD_TARGET))\ 798 $($(target)_LIBPATH.$(BUILD_TYPE))\ 799 $($(target)_LIBPATH)\ 800 $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \ 801 $($(target)_SDKS.$(BUILD_TYPE)) \ 802 $($(target)_SDKS),\ 803 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\ 804 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\ 805 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\ 806 $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\ 807 $(SDK_$(sdk)_LIBPATH))\ 808 $(LIBPATH.$(BUILD_TARGET_CPU))\ 809 $(LIBPATH.$(BUILD_TARGET_ARCH))\ 810 $(LIBPATH.$(BUILD_TARGET))\ 811 $(LIBPATH.$(BUILD_TYPE))\ 812 $(LIBPATH)\ 813 $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \ 814 $(SDKS.$(BUILD_TYPE)) \ 815 $(SDKS),\ 816 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\ 817 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\ 818 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\ 819 $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\ 820 $(SDK_$(sdk)_LIBPATH))\ 821 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\ 822 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\ 823 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\ 824 $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\ 825 $(TOOL_$(tool)_LIBPATH)\ 826 ) 827 $(eval dirdep := $(dir $(dll)).dir_created) 828 ## @todo fix dependencies 829 $(eval deps := $($(target)_DEPS)) 830 # 831 $(eval custom_pre := $(strip $(firstword 832 $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\ 833 $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\ 834 $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\ 835 $($(target)_CUSTOM_PRE)\ 836 $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\ 837 $(CUSTOM_PRE.$(BUILD_TARGET))\ 838 $(CUSTOM_PRE.$(BUILD_TYPE))\ 839 $(CUSTOM_PRE)\ 840 ))) 841 $(eval custom_post := $(strip $(firstword 842 $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\ 843 $($(target)_CUSTOM_POST.$(BUILD_TARGET))\ 844 $($(target)_CUSTOM_POST.$(BUILD_TYPE))\ 845 $($(target)_CUSTOM_POST)\ 846 $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\ 847 $(CUSTOM_POST.$(BUILD_TARGET))\ 848 $(CUSTOM_POST.$(BUILD_TYPE))\ 849 $(CUSTOM_POST)\ 850 ))) 851 $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))) 852 853 ifndef TOOL_$(tool)_LINK_DLL 854 $$(warning kBuild: TOOL_$(tool)_LINK_DLL is not defined. target=$(target) ) 855 $$(warning kBuild: tools: \ 856 1 $($(target)_$(source)TOOL.$(BUILD_TARGET)) \ 857 2 $($(target)_$(source)TOOL) \ 858 3 $($(target)_TOOL.$(BUILD_TARGET)) \ 859 4 $($(target)_TOOL) \ 860 5 $($(source)TOOL) \ 861 6 $($(source)TOOL.$(BUILD_TARGET)) \ 862 7 $(TOOL.$(BUILD_TARGET)) \ 863 8 $(TOOL) ) 864 endif 865 866 $(eval $(TOOL_$(tool)_LINK_DLL)) 867 868 869 # publish rule (still need work) 870 ifndef $(target)_NOINST 871 $(eval pubdll := $(PATH_BIN)/$(notdir $(dll))) 872 $(pubdll) : $(dll) $(dir $(pubdll)).dir_created 873 $(CP) $(dll) $(pubdll) 874 875 $(eval TARGET_PUB_$(target) := $(pubdll)) 876 _DLLS += $(pubdll) 877 _OUT_FILES += $(dll) $(pubdll) 878 else 879 _DLLS += $(dll) 880 _OUT_FILES += $(dll) 881 endif 882 _OBJS += $(_OBJS_$(target)) 883 endef 884 885 # Process dlls 886 $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)), $(eval $(def_dll))) 887 888 889 890 # 891 # Process import libraries. 892 # 893 # - On OS/2 and windows these are libraries. 894 # - On other platforms they are fake DLLs. 895 ifeq ($(subst win32,os2,$(BUILD_TARGET)),os2) 896 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval $(def_lib))) 897 else 898 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval $(def_dll))) 899 endif 900 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval _IMPORT_LIBS += $(firstword $(TARGET_PUB_$(target)) $(TARGET_$(target))))) 901 902 903 # 721 904 # PROGRAMS 722 905 # … … 871 1054 872 1055 # 873 # DLLS874 #875 876 ## DLL (one).877 # @param $(target) Normalized target (program) name.878 define def_dll879 # dllmod basics880 $(eval tool := $(call _TARGET_TOOL,$(target),LD))881 $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))882 $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))883 $(eval dllsuff := $(firstword $($(target)_DLLSUFF) $($(target)_DLLSUFF) $(TOOL_$(tool)_LDDLLSUFF) $(SUFF_DLL)))884 $(eval dll := $(outbase)$(dllsuff))885 $(eval TARGET_$(target) := $(dll))886 887 # source -> object888 $(eval $(def_target_sources))889 890 # dllmod linking.891 $(eval tool := $(call _TARGET_TOOL,$(target),LD))892 $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))893 $(eval objs = $(_OBJS_$(target)))894 $(eval flags :=\895 $(TOOL_$(tool)_LDFLAGS)\896 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\897 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\898 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\899 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\900 $(LDFLAGS)\901 $(LDFLAGS.$(BUILD_TYPE))\902 $(LDFLAGS.$(BUILD_TARGET))\903 $(LDFLAGS.$(BUILD_TARGET_ARCH))\904 $(LDFLAGS.$(BUILD_TARGET_CPU))\905 $($(target)_LDFLAGS)\906 $($(target)_LDFLAGS.$(BUILD_TYPE))\907 $($(target)_LDFLAGS.$(BUILD_TARGET))\908 $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\909 $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\910 )911 $(eval libs :=\912 $($(target)_LIBS.$(BUILD_TARGET_CPU))\913 $($(target)_LIBS.$(BUILD_TARGET_ARCH))\914 $($(target)_LIBS.$(BUILD_TARGET))\915 $($(target)_LIBS.$(BUILD_TYPE))\916 $($(target)_LIBS)\917 $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \918 $($(target)_SDKS.$(BUILD_TYPE)) \919 $($(target)_SDKS),\920 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\921 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\922 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\923 $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\924 $(SDK_$(sdk)_LIBS))\925 $(LIBS.$(BUILD_TARGET_CPU))\926 $(LIBS.$(BUILD_TARGET_ARCH))\927 $(LIBS.$(BUILD_TARGET))\928 $(LIBS.$(BUILD_TYPE))\929 $(LIBS)\930 $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \931 $(SDKS.$(BUILD_TYPE)) \932 $(SDKS),\933 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\934 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\935 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\936 $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\937 $(SDK_$(sdk)_LIBS))\938 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\939 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\940 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\941 $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\942 $(TOOL_$(tool)_LIBS)\943 )944 $(eval libpath :=\945 $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\946 $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\947 $($(target)_LIBPATH.$(BUILD_TARGET))\948 $($(target)_LIBPATH.$(BUILD_TYPE))\949 $($(target)_LIBPATH)\950 $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \951 $($(target)_SDKS.$(BUILD_TYPE)) \952 $($(target)_SDKS),\953 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\954 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\955 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\956 $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\957 $(SDK_$(sdk)_LIBPATH))\958 $(LIBPATH.$(BUILD_TARGET_CPU))\959 $(LIBPATH.$(BUILD_TARGET_ARCH))\960 $(LIBPATH.$(BUILD_TARGET))\961 $(LIBPATH.$(BUILD_TYPE))\962 $(LIBPATH)\963 $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \964 $(SDKS.$(BUILD_TYPE)) \965 $(SDKS),\966 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\967 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\968 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\969 $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\970 $(SDK_$(sdk)_LIBPATH))\971 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\972 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\973 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\974 $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\975 $(TOOL_$(tool)_LIBPATH)\976 )977 $(eval dirdep := $(dir $(dll)).dir_created)978 ## @todo fix dependencies979 $(eval deps := $($(target)_DEPS))980 #981 $(eval custom_pre := $(strip $(firstword982 $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\983 $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\984 $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\985 $($(target)_CUSTOM_PRE)\986 $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\987 $(CUSTOM_PRE.$(BUILD_TARGET))\988 $(CUSTOM_PRE.$(BUILD_TYPE))\989 $(CUSTOM_PRE)\990 )))991 $(eval custom_post := $(strip $(firstword992 $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\993 $($(target)_CUSTOM_POST.$(BUILD_TARGET))\994 $($(target)_CUSTOM_POST.$(BUILD_TYPE))\995 $($(target)_CUSTOM_POST)\996 $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\997 $(CUSTOM_POST.$(BUILD_TARGET))\998 $(CUSTOM_POST.$(BUILD_TYPE))\999 $(CUSTOM_POST)\1000 )))1001 $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))1002 1003 ifndef TOOL_$(tool)_LINK_DLL1004 $$(warning kBuild: TOOL_$(tool)_LINK_DLL is not defined. target=$(target) )1005 $$(warning kBuild: tools: \1006 1 $($(target)_$(source)TOOL.$(BUILD_TARGET)) \1007 2 $($(target)_$(source)TOOL) \1008 3 $($(target)_TOOL.$(BUILD_TARGET)) \1009 4 $($(target)_TOOL) \1010 5 $($(source)TOOL) \1011 6 $($(source)TOOL.$(BUILD_TARGET)) \1012 7 $(TOOL.$(BUILD_TARGET)) \1013 8 $(TOOL) )1014 endif1015 1016 $(eval $(TOOL_$(tool)_LINK_DLL))1017 1018 1019 # publish rule (still need work)1020 ifndef $(target)_NOINST1021 $(eval pubdll := $(PATH_BIN)/$(notdir $(dll)))1022 $(pubdll) : $(dll) $(dir $(pubdll)).dir_created1023 $(CP) $(dll) $(pubdll)1024 1025 _DLLS += $(pubdll)1026 _OUT_FILES += $(dll) $(pubdll)1027 else1028 _DLLS += $(dll)1029 _OUT_FILES += $(dll)1030 endif1031 _OBJS += $(_OBJS_$(target))1032 endef1033 1034 # Process dlls1035 $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)), $(eval $(def_dll)))1036 1037 1038 #1039 1056 # SYSMODS 1040 1057 # … … 1241 1258 1242 1259 #PASSES ?= needed libraries binaries others publish 1243 PASSES ?= libraries binaries others1260 PASSES ?= libraries dlls binaries others 1244 1261 1245 1262 ## Proritized list of the default makefile when walking subdirectories. … … 1310 1327 1311 1328 ## PASS: binaries 1312 # This pass builds binary targets, i.e. programs, dlls, system modules and stuff. 1313 pass_binaries_doit: $(_DLLS) $(_EXES) $(_SYSMODS) $(_OTHER_BINARIES) 1329 # This pass builds dll targets. 1330 pass_dlls_doit: $(_DLLS) $(_OTHER_DLLS) 1331 pass := dlls 1332 PASS := DLLS 1333 $(eval $(def_pass)) 1334 1335 ## PASS: binaries 1336 # This pass builds binary targets, i.e. programs, system modules and stuff. 1337 pass_binaries_doit: $(_EXES) $(_SYSMODS) $(_OTHER_BINARIES) 1314 1338 pass := binaries 1315 1339 PASS := BINARIES … … 1376 1400 target: needed libraries binaries others 1377 1401 objects: $(_OBJS) 1378 programs: $(_EXES) 1379 dlls: $(_DLLS) 1380 sysmods: $(_SYSMODS) 1402 libraries: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES) 1403 dlls: $(_DLLS) 1404 programs: $(_EXES) 1405 sysmods: $(_SYSMODS) 1381 1406 1382 1407
Note:
See TracChangeset
for help on using the changeset viewer.