Đang chuẩn bị liên kết để tải về tài liệu:
Lập trình Wrox Professional Xcode 3 cho Mac OS part 49
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Khi các mục tiêu PrimeRules được xây dựng, giai đoạn biên dịch nguồn chạy từng hạng mục nguồn của nó thông qua các quy tắc xây dựng cho mục tiêu. Các main.c fi le được biên dịch như bạn mong đợi. Bởi vì tuỳ chỉnh của bạn xây dựng quy tắc, các knownprimes.primetable fi le chạy kịch bản compilePrimeTables.sh, trong đó sản xuất một trung gian. C fi le. | 364 CHAPTER 16 TARGETS When the PrimeRules target is built the Compile Sources phase runs each of its source items through the build rules for the target. The main. c file gets compiled as you would expect. Because of your custom build rule the knownprimes .primetable file runs the compilePrimeTables . sh script which produces an intermediate . c file. The intermediate file is run back through the rules again and is eventually compiled by the C compiler. The two final object files main and knownprimes are linked together to form the finished executable. DEPENDENCIES A target dependency ensures that the targets required by the current target are built first. Basic targets produce a product from one or possibly thousands of source files. These are the atoms from which you assemble your project s finished product. When the product of one target is a source file in another target it creates a dependency you communicate that relationship to Xcode using target dependencies. You must define your target dependencies Xcode can t do it automatically. You create dependencies to guarantee that source items produced by other targets are up-to-date before proceeding as well as to order and group targets. A target can depend on another target in the same project or in a different project. Adding Target Dependencies To add a dependency to a target open the target s Info window. The General tab contains the Direct Dependencies list. Drag a target or targets from the project s Groups Files list into the list. Or you can click the button just below the list and Xcode presents a list of targets from which to choose as shown in Figure 16-17. Select one or more targets from the list and click the Add Target button. To remove a target select it in the list and click the - button. FIGURE 16-17 Download at getcoolebook.com Dependencies 365 Xcode cleverly prevents you from creating circular dependencies. Targets in the list that contain a dependency to the target you are editing either .