Linux all in one desk reference for dummies phần 10
Số trang: 142
Loại file: pdf
Dung lượng: 2.32 MB
Lượt xem: 12
Lượt tải: 0
Xem trước 10 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tham khảo tài liệu linux all in one desk reference for dummies phần 10, công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Linux all in one desk reference for dummies phần 10 647 Exploring the Software Development Tools in Linuxxviewobj.o: Makefile xviewobj.c xdraw.hshapes.o: Makefile shapes.c shapes.hThis makefile relies on GNU make’s implicit rules. The conversion of .c filesto .o files uses the built-in rule. Defining the variable CFLAGS passes theflags to the C compiler.The target named all is defined as the first target for a reason — if you runGNU make without specifying any targets in the command line (see the makesyntax described in the following section), the command builds the firsttarget it finds in the makefile. By defining the first target all as xdraw, youcan ensure that make builds this executable file, even if you do not explicitlyspecify it as a target. UNIX programmers traditionally use all as the name ofthe first target, but the target’s name is immaterial; what matters is that it isthe first target in the makefile.How to run makeTypically, you run make by simply typing the following command at the shellprompt:makeWhen run this way, GNU make looks for a file named GNUmakefile, makefile,or Makefile — in that order. If make finds one of these makefiles, it builds thefirst target specified in that makefile. However, if make does not find anappropriate makefile, it displays the following error message and then exits:make: *** No targets specified and no makefile found. Stop.If your makefile happens to have a different name from the default names,you have to use the -f option to specify the makefile. The syntax of the makecommand with this option is Book VIIImake -f filename Chapter 1where filename is the name of the makefile. ProgrammingEven when you have a makefile with a default name such as Makefile, you in Linuxmay want to build a specific target out of several targets defined in the make-file. In that case, you have to use the following syntax when you run make:make target TEAM LinG - Live, Informative, Non-cost and Genuine !648 Exploring the Software Development Tools in Linux For example, if the makefile contains the target named clean, you can build that target with this command: make clean Another special syntax overrides the value of a make variable. For example, GNU make uses the CFLAGS variable to hold the flags used when compiling C files. You can override the value of this variable when you invoke make. Here is an example of how you can define CFLAGS as the option -g -O2: make CFLAGS=”-g -O2” In addition to these options, GNU make accepts several other command-line options. Table 1-3 lists the GNU make options. Table 1-3 Options for GNU make Option Meaning Ignore but accept for compatibility with other versions of make. -b Change to the specified directory before reading the makefile. -C DIR Print debugging information. -d Allow environment variables to override definitions of similarly -e named variables in the makefile. -f FILE Read FILE as the makefile. Display the list of make options. -h Ignore all errors in commands executed when building a target. -i -I DIR Search specified directory for included makefiles. (The capabil- ity to include a file in a makefile is unique to GNU make.) Specify the number of commands that make can run -j NUM simultaneously. Continue to build unrelated targets, even if an error occurs -k when building one of the targets. -l LOAD Don’t start a new job if load average is at least LOAD (a floating- point number). Ignore but accept for compatibility with other versions of make. -m Print the commands to execute, but do not execute them. -n -o FILE Do not rebuild the file named FILE, even if it is older than its de ...
Nội dung trích xuất từ tài liệu:
Linux all in one desk reference for dummies phần 10 647 Exploring the Software Development Tools in Linuxxviewobj.o: Makefile xviewobj.c xdraw.hshapes.o: Makefile shapes.c shapes.hThis makefile relies on GNU make’s implicit rules. The conversion of .c filesto .o files uses the built-in rule. Defining the variable CFLAGS passes theflags to the C compiler.The target named all is defined as the first target for a reason — if you runGNU make without specifying any targets in the command line (see the makesyntax described in the following section), the command builds the firsttarget it finds in the makefile. By defining the first target all as xdraw, youcan ensure that make builds this executable file, even if you do not explicitlyspecify it as a target. UNIX programmers traditionally use all as the name ofthe first target, but the target’s name is immaterial; what matters is that it isthe first target in the makefile.How to run makeTypically, you run make by simply typing the following command at the shellprompt:makeWhen run this way, GNU make looks for a file named GNUmakefile, makefile,or Makefile — in that order. If make finds one of these makefiles, it builds thefirst target specified in that makefile. However, if make does not find anappropriate makefile, it displays the following error message and then exits:make: *** No targets specified and no makefile found. Stop.If your makefile happens to have a different name from the default names,you have to use the -f option to specify the makefile. The syntax of the makecommand with this option is Book VIIImake -f filename Chapter 1where filename is the name of the makefile. ProgrammingEven when you have a makefile with a default name such as Makefile, you in Linuxmay want to build a specific target out of several targets defined in the make-file. In that case, you have to use the following syntax when you run make:make target TEAM LinG - Live, Informative, Non-cost and Genuine !648 Exploring the Software Development Tools in Linux For example, if the makefile contains the target named clean, you can build that target with this command: make clean Another special syntax overrides the value of a make variable. For example, GNU make uses the CFLAGS variable to hold the flags used when compiling C files. You can override the value of this variable when you invoke make. Here is an example of how you can define CFLAGS as the option -g -O2: make CFLAGS=”-g -O2” In addition to these options, GNU make accepts several other command-line options. Table 1-3 lists the GNU make options. Table 1-3 Options for GNU make Option Meaning Ignore but accept for compatibility with other versions of make. -b Change to the specified directory before reading the makefile. -C DIR Print debugging information. -d Allow environment variables to override definitions of similarly -e named variables in the makefile. -f FILE Read FILE as the makefile. Display the list of make options. -h Ignore all errors in commands executed when building a target. -i -I DIR Search specified directory for included makefiles. (The capabil- ity to include a file in a makefile is unique to GNU make.) Specify the number of commands that make can run -j NUM simultaneously. Continue to build unrelated targets, even if an error occurs -k when building one of the targets. -l LOAD Don’t start a new job if load average is at least LOAD (a floating- point number). Ignore but accept for compatibility with other versions of make. -m Print the commands to execute, but do not execute them. -n -o FILE Do not rebuild the file named FILE, even if it is older than its de ...
Tìm kiếm theo từ khóa liên quan:
thủ thuật máy tính mẹo vặt máy tính kỹ thuật lập trình mẹo hay Linux tin học căn bản thủ thuật tin học tự học tin họcGợi ý tài liệu liên quan:
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 314 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 303 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 265 0 0 -
Cách phân tích thiết kế hệ thống thông tin quan trọng phần 4
13 trang 217 0 0 -
Thủ thuật chặn web đen bằng phần mềm
10 trang 215 0 0 -
Sửa lỗi các chức năng quan trọng của Win với ReEnable 2.0 Portable Edition
5 trang 212 0 0 -
Xử lý tình trạng máy tính khởi động/tắt chậm
4 trang 211 0 0 -
Bài giảng điện tử môn tin học: Quản trị các hệ thống thông tin quản lý xuyên quốc gia
27 trang 211 0 0 -
Giáo trình Bảo trì hệ thống và cài đặt phần mềm
68 trang 207 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 206 0 0