Add root level Makefile, make "shutdown" be optionally built by "make all"
authorDavin McCall <davmac@davmac.org>
Sun, 19 Jun 2016 17:05:01 +0000 (18:05 +0100)
committerDavin McCall <davmac@davmac.org>
Sun, 19 Jun 2016 17:05:01 +0000 (18:05 +0100)
(BUILD_SHUTDOWN in mconfig)

Makefile [new file with mode: 0644]
mconfig
src/Makefile

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..3614cbe
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,10 @@
+# Makefile for Dinit.
+
+all:
+       $(MAKE) -C src all
+
+install:
+       $(MAKE) -C src install
+
+clean:
+       $(MAKE) -C src clean
diff --git a/mconfig b/mconfig
index 3bdb14c1e47554068997f78d29fcbaa595be5670..b173e19d1b2eb31143fe8a8adeffcba0e4a8c7fa 100644 (file)
--- a/mconfig
+++ b/mconfig
@@ -1,14 +1,12 @@
-# LLVM/clang++ with libc++ on Linux
-#CXX=clang++
-#CXXOPTS=-stdlib=libc++ -std=gnu++11 -Os -Wall -fno-rtti
-#EXTRA_LIBS=-lc++abi
-
-# GCC. Note with GCC 5,5.1,5.2 the new C++11 ABI is buggy.
+# Linux (GCC). Note with GCC 5,5.1,5.2 the new C++11 ABI is buggy.
 CXX=g++
 CXXOPTS=-D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -Os -Wall -Wno-invalid-offsetof -fno-rtti
 EXTRA_LIBS=
+BUILD_SHUTDOWN=yes
 
 # OpenBSD, tested with GCC 4.9.3 and gmake:
 #CXX=eg++
 #CXXOPTS=-D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -Os -Wall -fno-rtti
 #EXTRA_LIBS=
+#BUILD_SHUTDOWN=no
+# (shutdown command not available for OpenBSD yet).
index b671fd50b0426338a9718b6c6c678e8bb68f225e..a163de031b5635842de6c0a4cfe9030565af97bf 100644 (file)
@@ -1,12 +1,14 @@
 -include ../mconfig
 
+ifeq ($(BUILD_SHUTDOWN),yes)
+  SHUTDOWN=shutdown
+endif
+
 objects = dinit.o load_service.o service.o control.o dinit-log.o dinitctl.o shutdown.o dinit-reboot.o
 
 dinit_objects = dinit.o load_service.o service.o control.o dinit-log.o
 
-all: dinit dinitctl
-
-shutdown-utils: shutdown
+all: dinit dinitctl $(SHUTDOWN)
 
 dinit: $(dinit_objects)
        $(CXX) -o dinit $(dinit_objects) $(EXTRA_LIBS)
@@ -23,9 +25,12 @@ dinit-reboot: dinit-reboot.o
 $(objects): %.o: %.cc service.h dinit-log.h control.h control-cmds.h cpbuffer.h
        $(CXX) $(CXXOPTS) -Idasynq -c $< -o $@
 
-#install: all
-
-#install.man:
+install: all
+       install -d $(DESTDIR)/sbin
+       install -s dinit dinitctl $(SHUTDOWN) $(DESTDIR)/sbin
+ifeq ($(BUILD_SHUTDOWN),yes)
+       install halt reboot $(DESTDIR)/sbin
+endif
 
 clean:
        rm -f *.o