diff --git a/config.mk.in b/config.mk.in index 958efdb3416..493a1f96fc5 100644 --- a/config.mk.in +++ b/config.mk.in @@ -81,7 +81,7 @@ LDFLAGS=@LDFLAGS@ # Project variables EXTRA_CFLAGS =@EXTRA_CFLAGS@ COMMON_CFLAGS = \ - -ggdb -O2 -DVERSION='"$(VERSION)"' -DMOD_DIR='"$(MOD_DIR)"' \ + -ggdb -O2 -DVERSION='"$(VERSION)"' \ -Wall -Wextra $(HAVE_FATAL_WARNINGS) \ -Wformat -Wformat-security \ -fstack-protector-all -D_FORTIFY_SOURCE=2 \ diff --git a/src/etc-cleanup/Makefile b/src/etc-cleanup/Makefile index 296ed41d8fa..23121c5215e 100644 --- a/src/etc-cleanup/Makefile +++ b/src/etc-cleanup/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/etc-cleanup -PROG = etc-cleanup +MOD = etc-cleanup +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/etc_groups.h diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile index 1f6a28780f5..f0e374a5204 100644 --- a/src/fbuilder/Makefile +++ b/src/fbuilder/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fbuilder -PROG = fbuilder +MOD = fbuilder +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/syscall.h diff --git a/src/fcopy/Makefile b/src/fcopy/Makefile index f82d3a073fc..a9f706eb858 100644 --- a/src/fcopy/Makefile +++ b/src/fcopy/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fcopy -PROG = fcopy +MOD = fcopy +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/syscall.h diff --git a/src/fids/Makefile b/src/fids/Makefile index c03740e3dfc..7bdbe059078 100644 --- a/src/fids/Makefile +++ b/src/fids/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fids -PROG = fids +MOD = fids +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile index 322ce3e3fbe..cc7a27c521f 100644 --- a/src/firecfg/Makefile +++ b/src/firecfg/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/firecfg -PROG = firecfg +MOD = firecfg +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = \ diff --git a/src/firejail/Makefile b/src/firejail/Makefile index a817b17570b..1c4b1b5c281 100644 --- a/src/firejail/Makefile +++ b/src/firejail/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/firejail -PROG = firejail +MOD = firejail +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = \ diff --git a/src/firemon/Makefile b/src/firemon/Makefile index 649bad0af67..0e39f8b018a 100644 --- a/src/firemon/Makefile +++ b/src/firemon/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/firemon -PROG = firemon +MOD = firemon +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/pid.h diff --git a/src/fldd/Makefile b/src/fldd/Makefile index 00173d18e76..246cbc18308 100644 --- a/src/fldd/Makefile +++ b/src/fldd/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fldd -PROG = fldd +MOD = fldd +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/syscall.h ../include/ldd_utils.h diff --git a/src/fnet/Makefile b/src/fnet/Makefile index 04a2009514e..c98326dc44c 100644 --- a/src/fnet/Makefile +++ b/src/fnet/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fnet -PROG = fnet +MOD = fnet +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/libnetlink.h diff --git a/src/fnetfilter/Makefile b/src/fnetfilter/Makefile index d38185fb194..c8992c3d6a5 100644 --- a/src/fnetfilter/Makefile +++ b/src/fnetfilter/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fnetfilter -PROG = fnetfilter +MOD = fnetfilter +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/syscall.h diff --git a/src/fnetlock/Makefile b/src/fnetlock/Makefile index 789df06ac9e..386b32082f2 100644 --- a/src/fnetlock/Makefile +++ b/src/fnetlock/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fnetlock -PROG = fnetlock +MOD = fnetlock +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) include $(ROOT)/src/prog.mk diff --git a/src/fnettrace-dns/Makefile b/src/fnettrace-dns/Makefile index fb10542616f..e7180de3fb8 100644 --- a/src/fnettrace-dns/Makefile +++ b/src/fnettrace-dns/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fnettrace-dns -PROG = fnettrace-dns +MOD = fnettrace-dns +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) include $(ROOT)/src/prog.mk diff --git a/src/fnettrace-icmp/Makefile b/src/fnettrace-icmp/Makefile index 4791e0b9f31..d449fbe7658 100644 --- a/src/fnettrace-icmp/Makefile +++ b/src/fnettrace-icmp/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fnettrace-icmp -PROG = fnettrace-icmp +MOD = fnettrace-icmp +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) include $(ROOT)/src/prog.mk diff --git a/src/fnettrace-sni/Makefile b/src/fnettrace-sni/Makefile index 09a444db01f..80af5e91441 100644 --- a/src/fnettrace-sni/Makefile +++ b/src/fnettrace-sni/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fnettrace-sni -PROG = fnettrace-sni +MOD = fnettrace-sni +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) include $(ROOT)/src/prog.mk diff --git a/src/fnettrace/Makefile b/src/fnettrace/Makefile index 68a4cbdc0a1..2ad296d1d92 100644 --- a/src/fnettrace/Makefile +++ b/src/fnettrace/Makefile @@ -2,12 +2,13 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fnettrace -PROG = fnettrace +MOD = fnettrace +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) include $(ROOT)/src/prog.mk all: $(TARGET) static-ip-map -static-ip-map: static-ip-map.txt fnettrace - ./fnettrace --squash-map=static-ip-map.txt > static-ip-map +static-ip-map: static-ip-map.txt $(PROG) + ./$(PROG) --squash-map=static-ip-map.txt > static-ip-map diff --git a/src/fsec-optimize/Makefile b/src/fsec-optimize/Makefile index 12ac5f1a9c3..caead9d54de 100644 --- a/src/fsec-optimize/Makefile +++ b/src/fsec-optimize/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fsec-optimize -PROG = fsec-optimize +MOD = fsec-optimize +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/seccomp.h ../include/syscall.h diff --git a/src/fsec-print/Makefile b/src/fsec-print/Makefile index a506c110659..43cc42fed2e 100644 --- a/src/fsec-print/Makefile +++ b/src/fsec-print/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fsec-print -PROG = fsec-print +MOD = fsec-print +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/seccomp.h ../include/syscall.h diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index a7d88eb83eb..89b12f62936 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fseccomp -PROG = fseccomp +MOD = fseccomp +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/syscall.h diff --git a/src/ftee/Makefile b/src/ftee/Makefile index 1b1cdec437b..f4d95de4a28 100644 --- a/src/ftee/Makefile +++ b/src/ftee/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/ftee -PROG = ftee +MOD = ftee +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) include $(ROOT)/src/prog.mk diff --git a/src/fzenity/Makefile b/src/fzenity/Makefile index cb80ec0bcd4..3c1aa0574c8 100644 --- a/src/fzenity/Makefile +++ b/src/fzenity/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/fzenity -PROG = fzenity +MOD = fzenity +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h diff --git a/src/include/common.h b/src/include/common.h index 03a71967b46..5f09fe3e250 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -41,8 +41,8 @@ #define errExit(msg) do { \ char msgout[500]; \ - snprintf(msgout, 500, "Error %s/%s:%d: %s: %s", \ - MOD_DIR, __FILE__, __LINE__, __func__, msg); \ + snprintf(msgout, 500, "Error %s:%d: %s: %s", \ + __FILE__, __LINE__, __func__, msg); \ perror(msgout); \ exit(1); \ } while (0) diff --git a/src/jailcheck/Makefile b/src/jailcheck/Makefile index 0b57861c6ea..1823ee9d075 100644 --- a/src/jailcheck/Makefile +++ b/src/jailcheck/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/jailcheck -PROG = jailcheck +MOD = jailcheck +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h ../include/pid.h diff --git a/src/lib/Makefile b/src/lib/Makefile index 9cf8abe3652..4b2303e5277 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -2,7 +2,8 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/lib +MOD = lib +MOD_DIR = $(ROOT)/src/$(MOD) TARGET = lib include $(ROOT)/src/prog.mk diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index c9e25d066c9..f66fdd0d758 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/libpostexecseccomp -SO = libpostexecseccomp.so +MOD = libpostexecseccomp +MOD_DIR = $(ROOT)/src/$(MOD) +SO = $(MOD_DIR)/$(MOD).so TARGET = $(SO) EXTRA_HDRS = ../include/seccomp.h ../include/rundefs.h diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index 337529361b7..3493d178647 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/libtrace -SO = libtrace.so +MOD = libtrace +MOD_DIR = $(ROOT)/src/$(MOD) +SO = $(MOD_DIR)/$(MOD).so TARGET = $(SO) include $(ROOT)/src/so.mk diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index 3e9d9e3e365..a8372616724 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/libtracelog -SO = libtracelog.so +MOD = libtracelog +MOD_DIR = $(ROOT)/src/$(MOD) +SO = $(MOD_DIR)/$(MOD).so TARGET = $(SO) EXTRA_HDRS = ../include/rundefs.h diff --git a/src/profstats/Makefile b/src/profstats/Makefile index aa947401e4f..8f33ce1deb3 100644 --- a/src/profstats/Makefile +++ b/src/profstats/Makefile @@ -2,8 +2,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -MOD_DIR = src/profstats -PROG = profstats +MOD = profstats +MOD_DIR = $(ROOT)/src/$(MOD) +PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) EXTRA_HDRS = ../include/common.h diff --git a/src/prog.mk b/src/prog.mk index b7ac597858d..7797f56b605 100644 --- a/src/prog.mk +++ b/src/prog.mk @@ -5,8 +5,8 @@ # The includer should probably define PROG and TARGET and may also want to # define EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES. -HDRS := $(sort $(wildcard *.h)) $(EXTRA_HDRS) -SRCS := $(sort $(wildcard *.c)) +HDRS := $(sort $(wildcard $(MOD_DIR)/*.h)) $(EXTRA_HDRS) +SRCS := $(sort $(wildcard $(MOD_DIR)/*.c)) OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS) .PHONY: all diff --git a/src/so.mk b/src/so.mk index c1913b79419..ceee9021f73 100644 --- a/src/so.mk +++ b/src/so.mk @@ -5,8 +5,8 @@ # The includer should probably define SO and TARGET and may also want to define # EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES. -HDRS := $(sort $(wildcard *.h)) $(EXTRA_HDRS) -SRCS := $(sort $(wildcard *.c)) +HDRS := $(sort $(wildcard $(MOD_DIR)/*.h)) $(EXTRA_HDRS) +SRCS := $(sort $(wildcard $(MOD_DIR)/*.c)) OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS) .PHONY: all