move /dev/shm to /tmp/shm
[project/procd.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 PROJECT(procd C)
4 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
5
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
7
8 IF(APPLE)
9   INCLUDE_DIRECTORIES(/opt/local/include)
10   LINK_DIRECTORIES(/opt/local/lib)
11 ENDIF()
12
13
14 ADD_LIBRARY(setlbf SHARED service/setlbf.c)
15 INSTALL(TARGETS setlbf
16         LIBRARY DESTINATION lib
17 )
18
19
20 SET(SOURCES procd.c signal.c watchdog.c state.c inittab.c rcS.c ubus.c system.c
21         service/service.c service/instance.c service/validate.c service/trigger.c service/watch.c
22         plug/coldplug.c plug/hotplug.c utils/utils.c)
23
24 SET(LIBS ubox ubus json-c blobmsg_json json_script)
25
26 IF(DEBUG)
27   ADD_DEFINITIONS(-DDEBUG -g3)
28 ENDIF()
29
30 IF(ZRAM_TMPFS)
31   ADD_DEFINITIONS(-DZRAM_TMPFS)
32   SET(SOURCES_ZRAM initd/zram.c)
33 ENDIF()
34
35 IF(BUILD_UPGRADED)
36   add_subdirectory(upgraded)
37 ENDIF()
38
39 ADD_EXECUTABLE(procd ${SOURCES})
40 TARGET_LINK_LIBRARIES(procd ${LIBS})
41 INSTALL(TARGETS procd
42         RUNTIME DESTINATION sbin
43 )
44
45
46 ADD_EXECUTABLE(init initd/init.c initd/early.c initd/preinit.c initd/mkdev.c watchdog.c
47         utils/utils.c ${SOURCES_ZRAM})
48 TARGET_LINK_LIBRARIES(init ${LIBS})
49 INSTALL(TARGETS init
50         RUNTIME DESTINATION sbin
51 )
52
53
54 ADD_EXECUTABLE(udevtrigger plug/udevtrigger.c)
55 INSTALL(TARGETS udevtrigger
56         RUNTIME DESTINATION sbin
57 )
58
59
60 ADD_EXECUTABLE(askfirst utils/askfirst.c)
61 INSTALL(TARGETS askfirst
62         RUNTIME DESTINATION sbin
63 )
64
65 ADD_CUSTOM_COMMAND(
66         OUTPUT syscall-names.h
67         COMMAND ./make_syscall_h.sh ${CMAKE_C_COMPILER} > ./syscall-names.h
68         DEPENDS ./make_syscall_h.sh
69 )
70 ADD_CUSTOM_TARGET(headers DEPENDS syscall-names.h)
71
72 IF(SECCOMP_SUPPORT)
73 ADD_LIBRARY(preload-seccomp SHARED jail/preload.c jail/seccomp.c)
74 TARGET_LINK_LIBRARIES(preload-seccomp dl ubox blobmsg_json)
75 INSTALL(TARGETS preload-seccomp
76         LIBRARY DESTINATION lib
77 )
78 ADD_DEPENDENCIES(preload-seccomp headers)
79 endif()
80
81 IF(JAIL_SUPPORT)
82 ADD_EXECUTABLE(ujail jail/jail.c jail/elf.c)
83 TARGET_LINK_LIBRARIES(ujail ubox)
84 INSTALL(TARGETS ujail
85         RUNTIME DESTINATION sbin
86 )
87
88 ADD_EXECUTABLE(utrace trace/trace.c)
89 TARGET_LINK_LIBRARIES(utrace ubox ${json} blobmsg_json)
90 INSTALL(TARGETS utrace
91         RUNTIME DESTINATION sbin
92 )
93 ADD_DEPENDENCIES(utrace headers)
94
95 ADD_LIBRARY(preload-trace SHARED trace/preload.c)
96 TARGET_LINK_LIBRARIES(preload-trace dl)
97 INSTALL(TARGETS preload-trace
98         LIBRARY DESTINATION lib
99 )
100 endif()