Changeset 219 for trunk/kBuild
- Timestamp:
- Feb 8, 2005, 2:50:34 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/footer.kmk
r207 r219 51 51 52 52 # all of a type 53 _OBJS :=54 _LIBS :=55 _DLLS :=56 _ EXES:=57 _SYSMODS :=58 _DIRS :=53 _OBJS := 54 _LIBS := 55 _DLLS := 56 _PROGRAMS := 57 _SYSMODS := 58 _DIRS := 59 59 _IMPORT_LIBS := 60 60 … … 632 632 633 633 $$(basename $$(notdir $$(obj))).o:: 634 $$(MAKE) -B -f $$(MAKEFILE) $(obj)634 + $$(MAKE) -B -f $$(MAKEFILE) $(obj) 635 635 $$(basename $$(notdir $$(obj))).obj:: 636 $$(MAKE) -B -f $$(MAKEFILE) $(obj)636 + $$(MAKE) -B -f $$(MAKEFILE) $(obj) 637 637 638 638 $(eval _OBJS_$(target) += $(obj)) … … 657 657 ,$(eval $(def_target_source_c_cpp_asm)) )) 658 658 endef 659 660 661 # 662 # NEEDED 663 # 664 665 ## Needed (one). 666 # @param $(target) Normalized target (program) name. 667 define def_needed 668 # basics 669 $(eval tool := $(call _TARGET_TOOL,$(target),LD)) 670 $(eval outbase := $(call _TARGET_BASE,$(target),$(target))) 671 $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))) 672 $(eval exesuff := $(firstword $($(target)_EXESUFF) $($(target)_EXESUFF) $(TOOL_$(tool)_LDEXESUFF) $(HOSTSUFF_EXE))) 673 $(eval exe := $(outbase)$(exesuff)) 674 $(eval TARGET_$(target) := $(exe)) 675 676 # source -> object 677 $(eval $(def_target_sources)) 678 679 # more library stuff. 680 $(eval tool := $(call _TARGET_TOOL,$(target),LD)) 681 $(eval outbase := $(call _TARGET_BASE,$(target),$(target))) 682 $(eval objs = $(_OBJS_$(target))) 683 $(eval flags :=\ 684 $(TOOL_$(tool)_LDFLAGS)\ 685 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\ 686 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\ 687 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\ 688 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\ 689 $(LDFLAGS)\ 690 $(LDFLAGS.$(BUILD_TYPE))\ 691 $(LDFLAGS.$(BUILD_TARGET))\ 692 $(LDFLAGS.$(BUILD_TARGET_ARCH))\ 693 $(LDFLAGS.$(BUILD_TARGET_CPU))\ 694 $($(target)_LDFLAGS)\ 695 $($(target)_LDFLAGS.$(BUILD_TYPE))\ 696 $($(target)_LDFLAGS.$(BUILD_TARGET))\ 697 $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\ 698 $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\ 699 ) 700 $(eval libs :=\ 701 $($(target)_LIBS.$(BUILD_TARGET_CPU))\ 702 $($(target)_LIBS.$(BUILD_TARGET_ARCH))\ 703 $($(target)_LIBS.$(BUILD_TARGET))\ 704 $($(target)_LIBS.$(BUILD_TYPE))\ 705 $($(target)_LIBS)\ 706 $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \ 707 $($(target)_SDKS.$(BUILD_TYPE)) \ 708 $($(target)_SDKS),\ 709 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\ 710 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\ 711 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\ 712 $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\ 713 $(SDK_$(sdk)_LIBS))\ 714 $(LIBS.$(BUILD_TARGET_CPU))\ 715 $(LIBS.$(BUILD_TARGET_ARCH))\ 716 $(LIBS.$(BUILD_TARGET))\ 717 $(LIBS.$(BUILD_TYPE))\ 718 $(LIBS)\ 719 $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \ 720 $(SDKS.$(BUILD_TYPE)) \ 721 $(SDKS),\ 722 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\ 723 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\ 724 $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\ 725 $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\ 726 $(SDK_$(sdk)_LIBS))\ 727 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\ 728 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\ 729 $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\ 730 $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\ 731 $(TOOL_$(tool)_LIBS)\ 732 ) 733 $(eval libpath :=\ 734 $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\ 735 $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\ 736 $($(target)_LIBPATH.$(BUILD_TARGET))\ 737 $($(target)_LIBPATH.$(BUILD_TYPE))\ 738 $($(target)_LIBPATH)\ 739 $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \ 740 $($(target)_SDKS.$(BUILD_TYPE)) \ 741 $($(target)_SDKS),\ 742 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\ 743 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\ 744 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\ 745 $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\ 746 $(SDK_$(sdk)_LIBPATH))\ 747 $(LIBPATH.$(BUILD_TARGET_CPU))\ 748 $(LIBPATH.$(BUILD_TARGET_ARCH))\ 749 $(LIBPATH.$(BUILD_TARGET))\ 750 $(LIBPATH.$(BUILD_TYPE))\ 751 $(LIBPATH)\ 752 $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \ 753 $(SDKS.$(BUILD_TYPE)) \ 754 $(SDKS),\ 755 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\ 756 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\ 757 $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\ 758 $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\ 759 $(SDK_$(sdk)_LIBPATH))\ 760 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\ 761 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\ 762 $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\ 763 $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\ 764 $(TOOL_$(tool)_LIBPATH)\ 765 ) 766 $(eval dirdep := $(dir $(exe)).dir_created) 767 ## @todo fix dependencies 768 $(eval deps := $($(target)_DEPS)) 769 # 770 $(eval custom_pre := $(strip $(firstword 771 $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\ 772 $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\ 773 $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\ 774 $($(target)_CUSTOM_PRE)\ 775 $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\ 776 $(CUSTOM_PRE.$(BUILD_TARGET))\ 777 $(CUSTOM_PRE.$(BUILD_TYPE))\ 778 $(CUSTOM_PRE)\ 779 ))) 780 $(eval custom_post := $(strip $(firstword 781 $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\ 782 $($(target)_CUSTOM_POST.$(BUILD_TARGET))\ 783 $($(target)_CUSTOM_POST.$(BUILD_TYPE))\ 784 $($(target)_CUSTOM_POST)\ 785 $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\ 786 $(CUSTOM_POST.$(BUILD_TARGET))\ 787 $(CUSTOM_POST.$(BUILD_TYPE))\ 788 $(CUSTOM_POST)\ 789 ))) 790 $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))) 791 792 $(eval $(TOOL_$(tool)_LINK_PROGRAM)) 793 # publish rule (still need work) 794 ifndef $(target)_INST 795 $(eval pubexe := $(PATH_BIN)/$(notdir $(exe))) 796 $(pubexe) : $(exe) $(dir $(pubexe)).dir_created 797 $(CP) $(exe) $(pubexe) 798 799 _NEEDED += $(pubexe) 800 _OUT_FILES += $(exe) $(pubexe) 801 else 802 _NEEDED += $(exe) 803 _OUT_FILES += $(exe) 804 endif 805 _OBJS += $(_OBJS_$(target)) 806 endef 807 808 # Process needed. 809 $(foreach target, $(NEEDED) $(NEEDED.$(BUILD_TARGET)), $(eval $(def_needed))) 810 659 811 660 812 … … 897 1049 # Process import libraries. 898 1050 # 899 # 1051 # - On OS/2 and windows these are libraries. 900 1052 # - On other platforms they are fake DLLs. 901 1053 ifeq ($(subst win32,os2,$(BUILD_TARGET)),os2) … … 906 1058 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval _IMPORT_LIBS += $(firstword $(TARGET_PUB_$(target)) $(TARGET_$(target))))) 907 1059 1060 908 1061 909 1062 # … … 1045 1198 $(CP) $(exe) $(pubexe) 1046 1199 1047 _ DLLS+= $(pubexe)1200 _PROGRAMS += $(pubexe) 1048 1201 _OUT_FILES += $(exe) $(pubexe) 1049 1202 else 1050 _ DLLS+= $(exe)1203 _PROGRAMS += $(exe) 1051 1204 _OUT_FILES += $(exe) 1052 1205 endif … … 1244 1397 define def_createdir 1245 1398 $(dirfile): 1246 $(call MSG_L target,Creating directory $$(@D))1399 $(call MSG_L1,Creating directory $$(@D)) 1247 1400 $(MKDIR) -p $$(@D) 1248 1401 @echo dir_created > $$@ … … 1276 1429 # @param $(tag) tag to attach to the rule name. 1277 1430 define def_pass_subdir 1278 pass_$(pass)$(tag):: 1279 $(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)1431 pass_$(pass)$(tag):: $(dep) 1432 + $(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass) 1280 1433 endef 1281 1434 … … 1286 1439 # @param $(tag) tag to attach to the rule name. 1287 1440 define def_pass_makefile 1288 pass_$(pass)$(tag):: 1289 $(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)1441 pass_$(pass)$(tag):: $(dep) 1442 + $(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass) 1290 1443 endef 1291 1444 … … 1301 1454 1302 1455 $(eval tag:=_before) 1456 $(eval dep:=) 1303 1457 $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir))) 1304 1458 $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)),$(eval $(def_pass_makefile))) 1305 1459 1306 1460 $(eval tag:=_after) 1461 $(eval dep:=pass_$(pass)_doit) 1307 1462 $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir))) 1308 1463 $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_makefile))) … … 1310 1465 .NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after 1311 1466 .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_doit pass_$(pass)_after 1312 pass_$(pass): \ 1313 pass_$(pass)_before \ 1314 pass_$(pass)_doit \ 1315 pass_$(pass)_after 1467 pass_$(pass)_doit: pass_$(pass)_before 1468 pass_$(pass)_after:: pass_$(pass)_doit 1469 pass_$(pass): pass_$(pass)_after 1316 1470 1317 1471 endef … … 1341 1495 ## PASS: binaries 1342 1496 # This pass builds binary targets, i.e. programs, system modules and stuff. 1343 pass_binaries_doit: $(_ EXES) $(_SYSMODS) $(_OTHER_BINARIES)1497 pass_binaries_doit: $(_PROGRAMS) $(_SYSMODS) $(_OTHER_BINARIES) 1344 1498 pass := binaries 1345 1499 PASS := BINARIES … … 1386 1540 # This pass just walks the tree. 1387 1541 pass_nothing_doit: 1388 $(call MSG_L target,Did nothing in $(CURDIR))1542 $(call MSG_L1,Did nothing in $(CURDIR)) 1389 1543 pass := nothing 1390 1544 PASS := NOTHING … … 1393 1547 1394 1548 1395 1549 ## Pass order 1550 # @param $(pass) Current pass name. 1551 # @param $(prev_pass) The previous pass name. 1552 define def_pass_order 1553 pass_$(pass)_order: $(pass_prev) 1554 $(call MSG_L1,Pass $(pass)) 1555 + $(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass) 1556 .NOTPARALLEL: pass_$(pass)_order 1557 $(eval pass_prev := pass_$(pass)_order) 1558 endef 1559 1560 ## PASS: order 1561 # Use dependencies to ensure correct pass order. 1562 pass_prev := 1563 $(foreach pass,$(PASSES),$(eval $(def_pass_order))) 1564 1565 1396 1566 # 1397 1567 # THE MAIN RULES 1398 1568 # 1399 all_recursive: $( foreach pass,$(PASSES),pass_$(pass))1569 all_recursive: $(pass_prev) 1400 1570 1401 1571 rebuild: clean 1402 $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive1572 + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive 1403 1573 1404 1574 … … 1408 1578 libraries: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES) 1409 1579 dlls: $(_DLLS) 1410 programs: $(_ EXES)1580 programs: $(_PROGRAMS) 1411 1581 sysmods: $(_SYSMODS) 1412 1582
Note:
See TracChangeset
for help on using the changeset viewer.