Makefile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # Makefile for AppArmor Linux Security Module
  2. #
  3. obj-$(CONFIG_SECURITY_APPARMOR) += apparmor.o
  4. apparmor-y := apparmorfs.o audit.o capability.o context.o ipc.o lib.o match.o \
  5. path.o domain.o policy.o policy_unpack.o procattr.o lsm.o \
  6. resource.o sid.o file.o
  7. clean-files := capability_names.h rlim_names.h
  8. # Build a lower case string table of capability names
  9. # Transforms lines from
  10. # #define CAP_DAC_OVERRIDE 1
  11. # to
  12. # [1] = "dac_override",
  13. quiet_cmd_make-caps = GEN $@
  14. cmd_make-caps = echo "static const char *capability_names[] = {" > $@ ;\
  15. sed $< >>$@ -r -n -e '/CAP_FS_MASK/d' \
  16. -e 's/^\#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/[\2] = "\L\1",/p';\
  17. echo "};" >> $@
  18. # Build a lower case string table of rlimit names.
  19. # Transforms lines from
  20. # #define RLIMIT_STACK 3 /* max stack size */
  21. # to
  22. # [RLIMIT_STACK] = "stack",
  23. #
  24. # and build a second integer table (with the second sed cmd), that maps
  25. # RLIMIT defines to the order defined in asm-generic/resource.h Thi is
  26. # required by policy load to map policy ordering of RLIMITs to internal
  27. # ordering for architectures that redefine an RLIMIT.
  28. # Transforms lines from
  29. # #define RLIMIT_STACK 3 /* max stack size */
  30. # to
  31. # RLIMIT_STACK,
  32. quiet_cmd_make-rlim = GEN $@
  33. cmd_make-rlim = echo "static const char *rlim_names[] = {" > $@ ;\
  34. sed $< >> $@ -r -n \
  35. -e 's/^\# ?define[ \t]+(RLIMIT_([A-Z0-9_]+)).*/[\1] = "\L\2",/p';\
  36. echo "};" >> $@ ;\
  37. echo "static const int rlim_map[] = {" >> $@ ;\
  38. sed -r -n "s/^\# ?define[ \t]+(RLIMIT_[A-Z0-9_]+).*/\1,/p" $< >> $@ ;\
  39. echo "};" >> $@
  40. $(obj)/capability.o : $(obj)/capability_names.h
  41. $(obj)/resource.o : $(obj)/rlim_names.h
  42. $(obj)/capability_names.h : $(srctree)/include/linux/capability.h
  43. $(call cmd,make-caps)
  44. $(obj)/rlim_names.h : $(srctree)/include/asm-generic/resource.h
  45. $(call cmd,make-rlim)