Section 6.9. Software Development Tools

6.9. Software Development Tools

The make development tool in Linux is GNU Make. As of this writing, the latest version of GNU Make is version 3.8, which this section is based on. Porting the build environment from HP-UX to Linux means using the GNU Make as well as making sure project makefiles use syntax that the GNU Make understands.

Because both HP-UX[27] and GNU Make conform to the POSIX standard, similarities between HP-UX and GNU makefile syntax abound. However, there are still some differences, which this section covers. The first differences to take note of are the command-line switches. Table 6-13 shows a comparison between HP-UX and GNU Make command-line switches.

[27] HP-UX make also conforms to SVID2, SVID3, XPG2, XPG3, XPG4.

Table 6-13. HP-UX Make and GNU Make Comparison Table

HP-UX Flag

HP-UX make Description[28]

GNU Make Equivalents

-b (default)

Compatibility mode for version 7 makefiles.



Turn off compatibility mode for version 7.

No equivalent


Debug mode.





Environment variable assignments within makefiles.

-e --environment-overrides

-f makefile

Use makefile as the makefile target.

-f makefile --file=file --makefile=file


Ignore error codes returned by invoked commands.



When command returns nonzero status, abandon work but continue on other branches that do not depend on abandoned target.



No execute mode; print commands, but do not execute.

-n --just-print --dry-run --recon


Print the complete set of macro definitions and target descriptions.

-p --print-data-base


Update in parallel more than onetarget at a time.

No equivalent


Question mode. Make returns a zero or nonzero status code depending on whether the target file is or is not up-to-date. Targets are not updated with this option.

-qReturn: 0 if target is up-to-date 1 if remaking required 2 if error encountered


Clear suffix list and do not use built-in rules.

-r --no-builtin-rules


Silent mode.

-s --silent --quiet


Terminate if an error occurs.

-S --no-keep-going --stop


Touch target files.



Unconditional make, ignoring timestamps.



Suppress warning messages.

No equivalent -w flag used for printing message for current working directory

[28] HP-UX make man pages

6.9.1. Makefile Syntax Target for the Form file((entry))

Library dependencies of the form libname ((entry)) are not supported by GNU Make. GNU Make supports libname(file.o), where file.o is the file containing the symbol. This feature was not put into GNU Make because of the nonmodularity of putting knowledge into make of the internal format of archive file symbol tables. Use of :=

Values assigned to a variable can be overridden by a conditional macro definition. A conditional macro definition takes on the form target := variable = value. When the target line associated with target is being processed, the macro value specified in the conditional macro definition is in effect. If variable was previously defined, the new value of variable overrides the previous definition. The new value of variable takes effect when target or any dependents of target are being processed.

HP-UX Make


CFLAGS = -O foo_prog := CFLAGS = -g foo_prog : foo1.o foo2.o bar.o    CFLAGS = -g will be in effect                                   for foo_prog target and any                                   dependents of the target                                   processed. 

GNU Make

In GNU Make, := is used for variable assignments. To override assigned values in GNU Make for target-specific variables, use the following syntax:

target := variable = value target : foo1.o foo2.o bar.o     variable = value will be in                                  effect for target and any                                  command scripts that create                                  their prerequisites. Use of $$@

HP-UX make uses the $$@ syntax, which is a System V make syntax, as part of the dependency list to refer to the current target. The following subsection shows an example of how $$@ is used in HP-UX makefiles.

HP-UX Make

$(targets): $$@.o lib.a

GNU Make

The preceding syntax can be replaced in a GNU makefile by using the following syntax:

$(target): %: %.o lib.a Empty Rules

In HP-UX makefiles, you can specify a suffix rule with no commands (to override an implicit rule). This can be confusing and also meaningless to GNU Make because the command line looks empty (it contains a single tab character). To specify an empty suffix rule with GNU Make, put a semicolon after the dependency, as follows:

.c.a: ; Suffix Support

HP-UX supports old-fashioned suffix rules, which GNU Make considers obsolete because pattern rules are more general and cleaner (see Table 6-14). GNU Make supports suffix rules for compatibility with older makefile syntax only.

Suffix rules come in two kinds: double-suffix and single-suffix.

A single-suffix rule looks like this:

.c .c~ .cxx .sh 

The equivalent pattern rule recognized by GNU Make for the .c suffix rule is as follows:

% : %.c 

A double-suffix rule looks like this:

.c.o .C.o .y.o 

The equivalent pattern rule for a .c.o suffix rule is as follows:

%.o : %.c 

Suffix rules that handle System V makefiles to support SCCS files that contain ~ are not recognized by GNU Make. In HP-UX, the suffix rule .c~.o creates the file x.o from the SCCS file s.n.c. GNU Make handles SCCS and RCS files differently by applying two pattern rules for extraction from SCCS or RCS in combination with general rules of rule chaining. For more information, refer to the GNU Make reference.[29]


Table 6-14. Summary of Differences Between HP-UX Make and GNU Make



GNU Make

Library dependencies

libname ((symbol))

libname (file.o)

Current target

$(targets) : $$@.o

$(target) : %: %.o

Conditional macro

$(targets) := c_flags = -g

$(targets) … : c_flags = -g

Empty rules


.c.a: ;

Suffix rules


Built in to GNU Make

[30] Linux Porting guide for HP-UX 11.x on PA platforms and GNU Make manual

6.9.2. Debuggers

On all Linux systems, the default application debugger for non-Java programs is the GNU debuggergdb for short. For HP-UX developers, gdb is a familiar tool because HP-UX v11 supports a version of gdb that has been ported to the HP-UX platform.

Invoking gdb on Linux yields the following:

$ gdb GNU gdb 6.1 Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-suse-linux". 

Invoking gdb on HP-UX yields the following:

$ gdb HP gdb 3.2 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00. Copyright 1986 - 2001 Free Software Foundation, Inc. Hewlett-Packard Wildebeest 3.2 (based on GDB) is covered by the GNU General Public License. Type "show copying" to see the conditions to change it and/or distribute copies. Type "show warranty" for warranty/support. 

See Chapter 7, "Testing and Debugging," for more information about the GNU debugger.

UNIX to Linux Porting. A Comprehensive Reference
UNIX to Linux Porting: A Comprehensive Reference
ISBN: 0131871099
EAN: 2147483647
Year: 2004
Pages: 175 © 2008-2017.
If you may any questions please contact us: