CXX : should be set to the name of the C++ compiler (and linker)
CXXOPTS : are options passed to the compiler during compilation (see note for GCC below)
- EXTRA_LIBS : are any extra libraries required for linking; should not normally be needed.
+ LDFLAGS : are any extra flags required for linking; should not normally be needed
+ (FreeBSD requires -lrt).
Defaults for Linux and OpenBSD are provided. Note that the "eg++" or "clang++" package must
be installed on OpenBSD as the default "g++" compiler is too old. Clang is part of the base
# the new ABI. See BUILD file for more information.
CXX=g++
CXXOPTS=-D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++11 -Os -Wall -fno-rtti
-EXTRA_LIBS=
+LDFLAGS=
BUILD_SHUTDOWN=yes
SANITIZEOPTS=-fsanitize=address,undefined
# OpenBSD, tested with GCC 4.9.3 / Clang++ 4/5 and gmake:
#CXX=clang++
#CXXOPTS=-std=gnu++11 -Os -Wall -fno-rtti
-#EXTRA_LIBS=
+#LDFLAGS=
#BUILD_SHUTDOWN=no
#SANITIZEOPTS=
# (shutdown command not available for OpenBSD yet).
# FreeBSD: use clang++ by default, supports sanitizers, requires linking with -lrt
#CXX=clang++
#CXXOPTS=-std=gnu++11 -Os -Wall -fno-rtti
-#EXTRA_LIBS=-lrt
+#LDFLAGS=-lrt
#BUILD_SHUTDOWN=no
#SANITIZEOPTS=-fsanitize=address,undefined
all: dinit dinitctl $(SHUTDOWN)
dinit: $(dinit_objects)
- $(CXX) -o dinit $(dinit_objects) $(EXTRA_LIBS)
+ $(CXX) -o dinit $(dinit_objects) $(LDFLAGS)
dinitctl: dinitctl.o
- $(CXX) -o dinitctl dinitctl.o $(EXTRA_LIBS)
+ $(CXX) -o dinitctl dinitctl.o $(LDFLAGS)
shutdown: shutdown.o
- $(CXX) -o shutdown shutdown.o $(EXTRA_LIBS)
+ $(CXX) -o shutdown shutdown.o $(LDFLAGS)
$(objects): %.o: %.cc
$(CXX) $(CXXOPTS) -MMD -MP -Iincludes -Idasynq -c $< -o $@
cd includes; ln -sf ../test-includes/*.h .
tests: prepare-incdir $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o
- $(CXX) $(SANITIZEOPTS) -o tests $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(EXTRA_LIBS)
+ $(CXX) $(SANITIZEOPTS) -o tests $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(LDFLAGS)
proctests: prepare-incdir $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o
- $(CXX) $(SANITIZEOPTS) -o proctests $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(EXTRA_LIBS)
+ $(CXX) $(SANITIZEOPTS) -o proctests $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(LDFLAGS)
$(objects): %.o: %.cc
$(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../dasynq -c $< -o $@