]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - system/system.mk
snort: fix build on sparc v8
[coffee/buildroot.git] / system / system.mk
1 ################################################################################
2 #
3 # system-related variables and macros
4 #
5 ################################################################################
6
7 # This file exists to define variables and macros that pertain to the system
8 # settings, like rsyncing a directory for skeletons, or the /lib vs. /usr/lib
9 # symlink handling.
10 #
11 # Some variables may be used as conditions in Makefile code, so they must be
12 # defined properly before they are used; this file is included early, before
13 # any package is.
14
15 # - SYSTEM_USR_SYMLINKS_OR_DIRS
16 #   create /lib, /bin and /sbin, either as directories or as symlinks to
17 #   their /usr conterparts
18 #
19 # - SYSTEM_RSYNC
20 #   rsync $(1) to $(2), with proper exclusions and rights
21 #
22 # - SYSTEM_LIB_SYMLINK
23 #   create the appropriate /lib{32,64} symlinks
24 #
25 # - SYSTEM_GETTY_PORT
26 # - SYSTEM_GETTY_BAUDRATE
27 # - SYSTEM_GETTY_TERM
28 # - SYSTEM_GETTY_OPTIONS
29 #   the un-quoted getty setting
30 #
31 # - SYSTEM_REMOUNT_ROOT_INITTAB
32 #   set inittab to remount root read-write or read-only
33 #
34
35 # This function handles the merged or non-merged /usr cases
36 ifeq ($(BR2_ROOTFS_MERGED_USR),y)
37 define SYSTEM_USR_SYMLINKS_OR_DIRS
38         ln -snf usr/bin $(1)/bin
39         ln -snf usr/sbin $(1)/sbin
40         ln -snf usr/lib $(1)/lib
41 endef
42 else
43 define SYSTEM_USR_SYMLINKS_OR_DIRS
44         $(INSTALL) -d -m 0755 $(1)/bin
45         $(INSTALL) -d -m 0755 $(1)/sbin
46         $(INSTALL) -d -m 0755 $(1)/lib
47 endef
48 endif
49
50 # This function rsyncs the skeleton directory in $(1) to the destination
51 # in $(2), which should be either $(TARTGET_DIR) or $(STAGING_DIR)
52 define SYSTEM_RSYNC
53         rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \
54                 --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \
55                 $(1)/ $(2)/
56 endef
57
58 # Make a symlink lib32->lib or lib64->lib as appropriate.
59 # MIPS64/n32 requires lib32 even though it's a 64-bit arch.
60 # $(1): base dir (either staging or target)
61 ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
62 define SYSTEM_LIB_SYMLINK
63         ln -snf lib $(1)/lib64
64         ln -snf lib $(1)/usr/lib64
65 endef
66 else
67 define SYSTEM_LIB_SYMLINK
68         ln -snf lib $(1)/lib32
69         ln -snf lib $(1)/usr/lib32
70 endef
71 endif
72
73 SYSTEM_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT))
74 SYSTEM_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE))
75 SYSTEM_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM))
76 SYSTEM_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS))
77
78 ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
79 # Find commented line, if any, and remove leading '#'s
80 define SYSTEM_REMOUNT_ROOT_INITTAB
81         $(SED) '/^#.*-o remount,rw \/$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
82 endef
83 else
84 # Find uncommented line, if any, and add a leading '#'
85 define SYSTEM_REMOUNT_ROOT_INITTAB
86         $(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab
87 endef
88 endif