Difference between revisions of "Real World Mozilla Makefile Lab"
(→Resources) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | [[ | + | [[Real World Mozilla]] > [[Real World Mozilla Day 2]] > Makefile Lab |
== Overview == | == Overview == | ||
Line 20: | Line 20: | ||
# You will know you are done when the following commands result in nled.exe being produced: | # You will know you are done when the following commands result in nled.exe being produced: | ||
+ | $ make | ||
$ make clean | $ make clean | ||
− | + | ||
or, if you want to combine this into one line: | or, if you want to combine this into one line: | ||
− | $ make | + | $ make && make clean |
== Hints == | == Hints == | ||
Line 40: | Line 41: | ||
* [http://www.gnu.org/software/make/manual/ GNU Make Manual] | * [http://www.gnu.org/software/make/manual/ GNU Make Manual] | ||
* [http://www.eng.hawaii.edu/Tutor/Make/ Make Tutorial] | * [http://www.eng.hawaii.edu/Tutor/Make/ Make Tutorial] | ||
+ | * [[Makefile.in Template for In-Tree Extensions]] |
Latest revision as of 13:05, 1 April 2008
Real World Mozilla > Real World Mozilla Day 2 > Makefile Lab
Contents
Overview
This lab is designed to give you first-hand experience creating a simple Makefile and using Make to build software. While the Mozilla build system is much more complex than this example, the ideas learned here will get you started understanding how Mozilla is built.
For nostalgic reasons we will work with the source code to Evan Weaver's nled editor, written in C.
Instructions
The lab machines have already been set-up to use MSVC 8 and MozillaBuild RC1. You only need to run Mozilla-Build MSVC 8.bat (there is a link on the desktop) to begin (i.e., you shouldn't need to install anything).
- Download and extract the nled source code
- Start Mozilla-Build MSVC8.bat to get a proper build environment
- Move to the directory where you extracted the source
- Using a text editor, create a file in this directory named Makefile
- Examine all the .c files to determine dependencies with the .h files
- Write targets and rules for each of the object files and the final executable
- Write a clean target in order to delete all .obj and .exe files
- You will know you are done when the following commands result in nled.exe being produced:
$ make $ make clean
or, if you want to combine this into one line:
$ make && make clean
Hints
- CL -c option
- CL -Fo option
- The default extension for object files on win32 is .obj vs. .o on Unix
- To create the executable (nled.exe) you must link all .obj files and user32.lib
- Running make with the -n option will show you all the commands make is going to run, which is helpful when debugging makefiles:
$ make -n