Add root level Makefile, make "shutdown" be optionally built by "make all"
[oweals/dinit.git] / src / Makefile
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