I stop on support on two make variants. Well, really on single GNU Make and one naive utility (nmake).

GNU Make is everyware (or can be everyware) in *NIX world. So I don't have stimulus to play with another make incarnations (for example, BSD make is very nice, but GNU Make more common). If GNU Make is present, I expect that other POSIX utilities (sed, awk, sh, grep, cat, test, ... ) present too.

To play with compilers from one Redmond's company, you may use nmake. The makefiles less attached to absolute paths, and really may be moved from one box to another, in contrast to MS's project files. Even more, VS's projects are castrated makefiles that processed by nmake; this process screened by GUI from users. Nmake is really restricted, and system based on it has less features and power then GNU make-based. But it work too.

To build program you need compiler-specific (often OS-specific) file like Makefile:

# -*- Makefile -*- Time-stamp: <06/08/04 10:54:19 ptr>

SRCROOT := ../../..
COMPILER_NAME := gcc

include Makefile.inc
include ${SRCROOT}/Makefiles/top.mak


INCLUDES += -I$(SRCROOT)/include -I$(BOOST_INCLUDE_DIR)

release-shared : LDLIBS = -lxmt -lboost_test_utf
stldbg-shared  : LDLIBS = -lxmtstlg -lboost_test_utfstlg
dbg-shared     : LDLIBS = -lxmtg -lboost_test_utfg

Here present reference to file with list of sources and program name (Makefile.inc), and inclusion of build system (that rules for common build use-cases, ${SRCROOT}/Makefiles/top.mak). The rest is custom options to this particular build: options for compiler and linker.

Another part is shared by all compilers and all OS, Makefile.inc contains name of program and list of sources:

# -*- makefile -*- Time-stamp: <04/05/06 18:40:56 ptr>

PRGNAME = mt_ut
SRC_CC = unit_test.cc timespec.cc mutex_test.cc spinlock_test.cc \
         recursive_mutex.cc join.cc signal-1.cc signal-2.cc flck.cc lfs.cc

The result of

make

will be compilation and linking program mt_ut in three (in case of STLport as STL implementation) or two (libstdc++) modes---release, debug, and STLPORT_DEBUG. Results will be in ./obj/gcc/so/mt_ut, ./obj/gcc/so_g/mt_ut, ./obj/gcc/so_stlg/mt_ut.

Note, that if you use STLport, the result not depends upon libstdc++.

As illustration I add here nmake-vc6.mak for VC6 compiler and nmake:

# -*- Makefile -*- Time-stamp: <03/10/17 19:42:29 ptr>

SRCROOT=..\..\..
COMPILER_NAME=vc6

!include Makefile.inc

INCLUDES=$(INCLUDES) /I "$(SRCROOT)/include" /I "$(STLPORT_INCLUDE_DIR)" /I "$(BOOST_INCLUDE_DIR)"
DEFS = $(DEFS) /D_STLP_USE_DYNAMIC_LIB

LDSEARCH=/LIBPATH:"$(CoMT_LIB_DIR)"
LDLIBS = xmt_vc6.lib boost_test_utf_vc6s.lib
!include $(SRCROOT)/Makefiles/nmake/top.mak

The same structure is for libraries, Makefile:

# -*- Makefile -*- Time-stamp: <06/11/10 16:23:01 ptr>

SRCROOT := ../..

include Makefile.inc
include ${SRCROOT}/Makefiles/top.mak

INCLUDES += -I$(SRCROOT)/include

Compiler-independent part, that contain list of sources, base name of library and it vertion (Makefile.inc):

# -*- Makefile -*- Time-stamp: <06/11/29 01:59:50 ptr>

LIBNAME = xmt
MAJOR = 1
MINOR = 9
PATCH = 3
SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc
SRC_C = fl.c

And again, as reference, file for VC6/nmake (nmake-vc6.mak):

# -*- Makefile -*- Time-stamp: <03/09/28 19:14:05 ptr>

SRCROOT=..\..
COMPILER_NAME=vc6

!include Makefile.inc

DEFS = /D_STLP_USE_DYNAMIC_LIB
INCLUDES=$(INCLUDES) /I "$(SRCROOT)/include" /I "$(STLPORT_INCLUDE_DIR)"
OPT_STLDBG = /Zm800
LDSEARCH=$(LDSEARCH) /LIBPATH:$(STLPORT_LIB_DIR)

!include $(SRCROOT)/Makefiles/nmake/top.mak
Next >>