What is the difference between Alcatel-Lucent nmake and gnu make?
This document compares and contrast the features of GNU make version 3.75 and nmake version 3.x. The intention here is to facilitate Lucent software development product teams in deciding on the tool that best fits their environment. The strength and weakness of both tools are outlined and compared.
A GNU make to nmake makefile conversion example is provided to give users an idea of the mapping of the features of both tools and the ease of the conversion effort.
For additional discussion of nmake benefits see the Impact of Features section.
Table of Contents
- Compare GNU make and nmake
- Contrast of GNU make and nmake
- Makefile Conversion Example -- GNU make to nmake
I. Compare GNU make and nmake
This table provides a summary of the similarities of GNU make and nmake.
| GNU make | nmake |
|---|---|
| GENERAL RULE FORMAT | |
|
|
IMPLICIT RULES DEFINITION |
|
|
|
VARIABLE DEFINITION |
|
|
|
II. Contrast of GNU make and nmake
This table provides a summary of the differences between GNU make and nmake. It is not exhaustive. The intent was to highlight those areas where one would be likely to assume similarities and point out features present in one and absent in another that seem to be of significance.
| GNU make | nmake |
|---|---|
| MAKEFILE PROCESSING | |
|
|
RE-MAKING TARGETS |
|
|
|
PREPROCESSING |
|
|
|
COMMAND EXECUTION |
|
|
|
AUTOMATIC DETECTION OF DEPENDENCIES |
|
|
|
SEARCHING DIRECTORIES FOR DEPENDENCIES |
|
|
|
|
|
INCLUDING OTHER MAKEFILES |
|
|
|
|
|
|
|
A SPECIAL METARULE |
|
|
|
OPERATIONS ON VARIABLES |
|
|
|
VARIABLES (Used by Engine) |
|
|
|
|
|
AUTOMATIC VARIABLES |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USING THE VALUE OF A VARIABLE AS A PREREQUISITE |
|
|
|
RECURSIVE MAKES |
|
|
|
|
|
DISTRIBUTED BUILDS |
|
|
|
DOUBLE COLON RULE |
|
|
|
|
|
COMPUTED VARIABLE NAMES |
|
|
|
ATTRIBUTE DIFFERENCES |
|
|
|
|
|
VARIABLE DEFINITION USING OUTPUT OF SHELL COMMANDS |
|
|
|
|
|
HIGH-LEVEL ACCESS TO CANNED BASIC ASSERTIONS |
|
|
|
COMMON ACTIONS |
|
|
|
III. A Makefile Conversion Example -- GNU make to nmake
A Sample GNU Makefile
# NOTE: This makefile is a modified version of the one in the GNU make
# that generates the GNU 'tar' program.
SHELL = /bin/sh
srcdir = .
CC = gcc -O
YACC = bison -y
INSTALL = /usr/local/bin/install -c
INSTALLDATA = /usr/local/bin/install -c -m 644
DEFS = -DSIGTYPE=int -DDIRENT -DSTRSTR_MISSING \
-DVPRINTF_MISSING -DBSD42
LIBS =
DEF_AR_FILE = /dev/rmt8
DEFBLOCKING = 20
CDEBUG = -g
CFLAGS = $(CDEBUG) -I. -I$(srcdir) $(DEFS) \
-DDEF_AR_FILE=\"$(DEF_AR_FILE)\" \
-DDEFBLOCKING=$(DEFBLOCKING)
LDFLAGS = -g
# The directory to install tar in.
bindir = /usr/local/bin
# The directory to install the info files in.
infodir = /usr/local/info
OBJS = tar.o create.o extract.o buffer.o \
getoldopt.o update.o gnu.o mangle.o \
version.o list.o names.o diffarch.o \
port.o wildmat.o getopt.o \
getopt1.o regex.o getdate.o rtapelib.o
all: tar rmt tar.info
tar: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
rmt: rmt.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rmt.c
tar.info: tar.texinfo
makeinfo tar.texinfo
install: all
$(INSTALL) tar $(bindir)/$(binprefix)tar
-test ! -f rmt || $(INSTALL) rmt /etc/rmt
$(INSTALLDATA) $(srcdir)/tar.info* $(infodir)
$(OBJS): tar.h port.h testpad.h
regex.o buffer.o tar.o: regex.h
testpad.h: testpad
./testpad
testpad: testpad.o
$(CC) -o $@ testpad.o
clean:
rm -f *.o tar rmt testpad testpad.h core
Conversion of above GNU Makefile to nmake Makefile
/*
** NOTE: This makefile is a modified version of the one in the GNU make
** that generates the GNU 'tar' program.
*/
YACC = bison -y
SIGTYPE == int
DIRENT == 1
STRSTR_MISSING == 1
VPRINTF_MISSING == 1
BSD42 == 1
DEF_AR_FILE == "/dev/rmt8"
DEFBLOCKING == 20
CC = gcc
CCFLAGS = -O -g
LDFLAGS = -g
BINDIR = /usr/local/bin
INFODIR = /usr/local/info
ETCDIR = /etc
SRCS = tar.c create.c extract.c buffer.c \
getoldopt.c update.c gnu.c mangle.c \
version.c list.c names.c diffarch.c \
port.c wildmat.c getopt.c \
getopt1.c regex.c getdate.c rtapelib.c
:ALL: tar rmt tar.info
$(BINDIR) :INSTALLDIR: tar
$(ETCDIR) :INSTALLDIR: rmt
$(INFODIR) :INSTALLDIR: tar.info mode=644
tar :: $(SRCS) $(LIBS)
rmt :: rmt.c
tar.info : tar.texinfo
makeinfo $(*)
testpad.h : testpad
$(*)
testpad :: testpad.c
Conversion Notes
- The clean target in the GNU Makefile is handled by the
nmake command:
$ nmake clean - The install target in the GNU Makefile is handled by the
:INSTALLDIR: operators and the nmake command:
$ nmake install - No need to specify header file dependencies, nmake scans for them!
- No need to specify -I options in CCFLAGS, nmake generates the -I options using the '.SOURCE.h : .' (the default) defined in the base rules.
- The -D<name> flags are declared as state variables (via '==') -- nmake scans the source files for their use and includes the -D flags when needed. There is no need to include them in CCFLAGS. The -D option values are true dependencies when state variables are used, nmake automatically recompiles affected files when the values change.
- No need to specify the action blocks for creating the tar and rmt executables -- nmake knows how to create them using the '::' operator.