![]() |
![]() |
|||
![]() |
![]() |
![]() |
||
![]() Home Facilities |
|
"Make" Utility Basics1.) Why Use a Make UtilityUsing the GUI provided in the mon68k or sim68k tool works well for projects that can be built with a relatively small number of files (2 or 3 max). When the number of files in the build gets larger, switching over to using a "make" utility will generally save time. One of the main benefits of using a "make" utility is that the make utility will keep track of dependencies between your files and rebuild only the files that need to be rebuilt. For example, if you have a program that is broken up among 5 files, you change 2 files, and then you want to rebuild the program, the "make" utility will check the time/date stamp on each of the files, determine that two are out of date, re-assemble the two modified files, and then re-link the application. Both the GNU make utility "make" and the Microsoft make utility "nmake" are loaded on the machines in the lab. There are a few differences, but the utilities have basically the same function. Both utilities are in the path on lab machines in LH035. 2.) Makefile Construction The make utility is dependent on a file called a "makefile" to define the dependencies between the files in your application. When you invoke make (GNU) or nmake (Microsoft), the utility looks for a file named makefile in the current directory by default. If the name of the makefile is other than this, you can pass it as a command line argument to the make utility. Below is an example of the contents of a simple makefile. drv_main.o: drv_main.s
This line can be described more generally by the following: target:dependency
In the case of the above example with drv_main, if drv_main.s is younger than drv_main.o (ie. it has been edited), the command " drv_main.s -o drv_main.o" will cause the assembler to rebuild drv_main.o to bring it up to date. "" is just a string replacement mechanism for the make utility. The variables get replaced with a string defined in the makefile like "FOO = foobar". In this case, gets replaced by as68000 (SDS assembler) and gets replaced by the different assembler flags. Note: For the GNU "make" utility, the white space in front of the command to execute must be a <tab>. For the "nmake" utility, spaced will also work. I have been using nmake to build my programs, so my examples will have spaces before the command. Change these to a <tab> if you want to use GNU make. 3.) For More Info .... You can use the unix man page for make. If you want to do more complex things with the make utility, there is also a book out on just this utility. I have not personally read this book. Here is a URL to where you can purchase the book. Link to Publisher of Make Utility Book 3.) Example Here is an example of a simple makefile.
# Makefile to build the IDP68040 application "motor_drv"
# set up define statements for the SDS assembler and linker then setup
the flags for the tools.
all: drv.out drv_main.o: drv_main.s
global.o: global.s
mctrl.o: mctrl.s
wspd.o: wspd.s
schedule.o: schedule.s
timer.o: timer.s
pwm.o: pwm.s
vector.o: vector.s
drv.out: drv_main.o global.o wspd.o schedule.o timer.o pwm.o vector.o
mctrl.o in_file.spc link.spc
|
||
![]() |
![]() |
Home || Facilities: FAQ | System Notices | Help | Hardware | Software | Network | Policies | Lindley Hall | Internal |
||
![]() |
![]() |
|
||
![]() |
|
| ||
|