aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-07-02 22:19:48 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2024-01-19 11:40:34 -0300
commit5b1bd33c7dc1b96cc27e4e52e8bdfe63268887e9 (patch)
tree9b9920abdf4c4881bf85ae2d08a44ed097f9209b /src
parentmodif: Change errExit msg format to match assert (diff)
downloadfirejail-5b1bd33c7dc1b96cc27e4e52e8bdfe63268887e9.tar.gz
firejail-5b1bd33c7dc1b96cc27e4e52e8bdfe63268887e9.tar.zst
firejail-5b1bd33c7dc1b96cc27e4e52e8bdfe63268887e9.zip
build: use full paths on compile/link targets
This makes the compile commands clearer when building in parallel (with `make -j`) and ensures that `__FILE__` includes the full build-time path (relative to the root of the repository) whenever it is referenced, such as in failed assert() messages (currently the full path is only shown in errExit() messages). Example: Before: firejail: main.c:100: main: Assertion `1 == 2' failed. Error src/firecfg/main.c:100: main: malloc: Cannot allocate memory After: firejail: ../../src/firejail/main.c:100: main: Assertion `1 == 2' failed. Error ../../src/firecfg/main.c:100: main: malloc: Cannot allocate memory Commands used to search and replace: $ git grep -Ilz '^MOD_DIR =' -- '*Makefile' | xargs -0 -I '{}' \ sh -c "printf '%s\n' \"\$(sed -E \ -e 's|^MOD_DIR = src/(.*)|MOD = \\1\\nMOD_DIR = \$(ROOT)/src/\$(MOD)|' \ -e 's:^(PROG|SO) = [^.]+(\.so)?$:\\1 = \$(MOD_DIR)/\$(MOD)\2:' \ '{}')\" >'{}'" $ git grep -Ilz '^HDRS :=' -- '*.mk' | xargs -0 -I '{}' \ sh -c "printf '%s\n' \"\$(sed -E \ -e 's|wildcard (\*\..)|wildcard \$(MOD_DIR)/\\1|' '{}')\" >'{}'" Note: config.mk.in, src/fnettrace/Makefile and src/include/common.h were edited manually. This is a follow-up to #5871.
Diffstat (limited to 'src')
-rw-r--r--src/etc-cleanup/Makefile5
-rw-r--r--src/fbuilder/Makefile5
-rw-r--r--src/fcopy/Makefile5
-rw-r--r--src/fids/Makefile5
-rw-r--r--src/firecfg/Makefile5
-rw-r--r--src/firejail/Makefile5
-rw-r--r--src/firemon/Makefile5
-rw-r--r--src/fldd/Makefile5
-rw-r--r--src/fnet/Makefile5
-rw-r--r--src/fnetfilter/Makefile5
-rw-r--r--src/fnetlock/Makefile5
-rw-r--r--src/fnettrace-dns/Makefile5
-rw-r--r--src/fnettrace-icmp/Makefile5
-rw-r--r--src/fnettrace-sni/Makefile5
-rw-r--r--src/fnettrace/Makefile9
-rw-r--r--src/fsec-optimize/Makefile5
-rw-r--r--src/fsec-print/Makefile5
-rw-r--r--src/fseccomp/Makefile5
-rw-r--r--src/ftee/Makefile5
-rw-r--r--src/fzenity/Makefile5
-rw-r--r--src/include/common.h4
-rw-r--r--src/jailcheck/Makefile5
-rw-r--r--src/lib/Makefile3
-rw-r--r--src/libpostexecseccomp/Makefile5
-rw-r--r--src/libtrace/Makefile5
-rw-r--r--src/libtracelog/Makefile5
-rw-r--r--src/profstats/Makefile5
-rw-r--r--src/prog.mk4
-rw-r--r--src/so.mk4
29 files changed, 85 insertions, 59 deletions
diff --git a/src/etc-cleanup/Makefile b/src/etc-cleanup/Makefile
index 296ed41d8..23121c521 100644
--- a/src/etc-cleanup/Makefile
+++ b/src/etc-cleanup/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/etc-cleanup 5MOD = etc-cleanup
6PROG = etc-cleanup 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/etc_groups.h 10EXTRA_HDRS = ../include/etc_groups.h
diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile
index 1f6a28780..f0e374a52 100644
--- a/src/fbuilder/Makefile
+++ b/src/fbuilder/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fbuilder 5MOD = fbuilder
6PROG = fbuilder 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/syscall.h 10EXTRA_HDRS = ../include/common.h ../include/syscall.h
diff --git a/src/fcopy/Makefile b/src/fcopy/Makefile
index f82d3a073..a9f706eb8 100644
--- a/src/fcopy/Makefile
+++ b/src/fcopy/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fcopy 5MOD = fcopy
6PROG = fcopy 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/syscall.h 10EXTRA_HDRS = ../include/common.h ../include/syscall.h
diff --git a/src/fids/Makefile b/src/fids/Makefile
index c03740e3d..7bdbe0590 100644
--- a/src/fids/Makefile
+++ b/src/fids/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fids 5MOD = fids
6PROG = fids 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h 10EXTRA_HDRS = ../include/common.h
diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile
index 322ce3e3f..cc7a27c52 100644
--- a/src/firecfg/Makefile
+++ b/src/firecfg/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/firecfg 5MOD = firecfg
6PROG = firecfg 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = \ 10EXTRA_HDRS = \
diff --git a/src/firejail/Makefile b/src/firejail/Makefile
index a817b1757..1c4b1b5c2 100644
--- a/src/firejail/Makefile
+++ b/src/firejail/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/firejail 5MOD = firejail
6PROG = firejail 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = \ 10EXTRA_HDRS = \
diff --git a/src/firemon/Makefile b/src/firemon/Makefile
index 649bad0af..0e39f8b01 100644
--- a/src/firemon/Makefile
+++ b/src/firemon/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/firemon 5MOD = firemon
6PROG = firemon 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/pid.h 10EXTRA_HDRS = ../include/common.h ../include/pid.h
diff --git a/src/fldd/Makefile b/src/fldd/Makefile
index 00173d18e..246cbc183 100644
--- a/src/fldd/Makefile
+++ b/src/fldd/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fldd 5MOD = fldd
6PROG = fldd 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/syscall.h ../include/ldd_utils.h 10EXTRA_HDRS = ../include/common.h ../include/syscall.h ../include/ldd_utils.h
diff --git a/src/fnet/Makefile b/src/fnet/Makefile
index 04a200951..c98326dc4 100644
--- a/src/fnet/Makefile
+++ b/src/fnet/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fnet 5MOD = fnet
6PROG = fnet 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/libnetlink.h 10EXTRA_HDRS = ../include/common.h ../include/libnetlink.h
diff --git a/src/fnetfilter/Makefile b/src/fnetfilter/Makefile
index d38185fb1..c8992c3d6 100644
--- a/src/fnetfilter/Makefile
+++ b/src/fnetfilter/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fnetfilter 5MOD = fnetfilter
6PROG = fnetfilter 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/syscall.h 10EXTRA_HDRS = ../include/common.h ../include/syscall.h
diff --git a/src/fnetlock/Makefile b/src/fnetlock/Makefile
index 789df06ac..386b32082 100644
--- a/src/fnetlock/Makefile
+++ b/src/fnetlock/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fnetlock 5MOD = fnetlock
6PROG = fnetlock 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9include $(ROOT)/src/prog.mk 10include $(ROOT)/src/prog.mk
diff --git a/src/fnettrace-dns/Makefile b/src/fnettrace-dns/Makefile
index fb1054261..e7180de3f 100644
--- a/src/fnettrace-dns/Makefile
+++ b/src/fnettrace-dns/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fnettrace-dns 5MOD = fnettrace-dns
6PROG = fnettrace-dns 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9include $(ROOT)/src/prog.mk 10include $(ROOT)/src/prog.mk
diff --git a/src/fnettrace-icmp/Makefile b/src/fnettrace-icmp/Makefile
index 4791e0b9f..d449fbe76 100644
--- a/src/fnettrace-icmp/Makefile
+++ b/src/fnettrace-icmp/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fnettrace-icmp 5MOD = fnettrace-icmp
6PROG = fnettrace-icmp 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9include $(ROOT)/src/prog.mk 10include $(ROOT)/src/prog.mk
diff --git a/src/fnettrace-sni/Makefile b/src/fnettrace-sni/Makefile
index 09a444db0..80af5e914 100644
--- a/src/fnettrace-sni/Makefile
+++ b/src/fnettrace-sni/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fnettrace-sni 5MOD = fnettrace-sni
6PROG = fnettrace-sni 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9include $(ROOT)/src/prog.mk 10include $(ROOT)/src/prog.mk
diff --git a/src/fnettrace/Makefile b/src/fnettrace/Makefile
index 68a4cbdc0..2ad296d1d 100644
--- a/src/fnettrace/Makefile
+++ b/src/fnettrace/Makefile
@@ -2,12 +2,13 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fnettrace 5MOD = fnettrace
6PROG = fnettrace 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9include $(ROOT)/src/prog.mk 10include $(ROOT)/src/prog.mk
10 11
11all: $(TARGET) static-ip-map 12all: $(TARGET) static-ip-map
12static-ip-map: static-ip-map.txt fnettrace 13static-ip-map: static-ip-map.txt $(PROG)
13 ./fnettrace --squash-map=static-ip-map.txt > static-ip-map 14 ./$(PROG) --squash-map=static-ip-map.txt > static-ip-map
diff --git a/src/fsec-optimize/Makefile b/src/fsec-optimize/Makefile
index 12ac5f1a9..caead9d54 100644
--- a/src/fsec-optimize/Makefile
+++ b/src/fsec-optimize/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fsec-optimize 5MOD = fsec-optimize
6PROG = fsec-optimize 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/seccomp.h ../include/syscall.h 10EXTRA_HDRS = ../include/common.h ../include/seccomp.h ../include/syscall.h
diff --git a/src/fsec-print/Makefile b/src/fsec-print/Makefile
index a506c1106..43cc42fed 100644
--- a/src/fsec-print/Makefile
+++ b/src/fsec-print/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fsec-print 5MOD = fsec-print
6PROG = fsec-print 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/seccomp.h ../include/syscall.h 10EXTRA_HDRS = ../include/common.h ../include/seccomp.h ../include/syscall.h
diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile
index a7d88eb83..89b12f629 100644
--- a/src/fseccomp/Makefile
+++ b/src/fseccomp/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fseccomp 5MOD = fseccomp
6PROG = fseccomp 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/syscall.h 10EXTRA_HDRS = ../include/common.h ../include/syscall.h
diff --git a/src/ftee/Makefile b/src/ftee/Makefile
index 1b1cdec43..f4d95de4a 100644
--- a/src/ftee/Makefile
+++ b/src/ftee/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/ftee 5MOD = ftee
6PROG = ftee 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9include $(ROOT)/src/prog.mk 10include $(ROOT)/src/prog.mk
diff --git a/src/fzenity/Makefile b/src/fzenity/Makefile
index cb80ec0bc..3c1aa0574 100644
--- a/src/fzenity/Makefile
+++ b/src/fzenity/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/fzenity 5MOD = fzenity
6PROG = fzenity 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h 10EXTRA_HDRS = ../include/common.h
diff --git a/src/include/common.h b/src/include/common.h
index 03a71967b..5f09fe3e2 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -41,8 +41,8 @@
41 41
42#define errExit(msg) do { \ 42#define errExit(msg) do { \
43 char msgout[500]; \ 43 char msgout[500]; \
44 snprintf(msgout, 500, "Error %s/%s:%d: %s: %s", \ 44 snprintf(msgout, 500, "Error %s:%d: %s: %s", \
45 MOD_DIR, __FILE__, __LINE__, __func__, msg); \ 45 __FILE__, __LINE__, __func__, msg); \
46 perror(msgout); \ 46 perror(msgout); \
47 exit(1); \ 47 exit(1); \
48} while (0) 48} while (0)
diff --git a/src/jailcheck/Makefile b/src/jailcheck/Makefile
index 0b57861c6..1823ee9d0 100644
--- a/src/jailcheck/Makefile
+++ b/src/jailcheck/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/jailcheck 5MOD = jailcheck
6PROG = jailcheck 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h ../include/pid.h 10EXTRA_HDRS = ../include/common.h ../include/pid.h
diff --git a/src/lib/Makefile b/src/lib/Makefile
index 9cf8abe36..4b2303e52 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -2,7 +2,8 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/lib 5MOD = lib
6MOD_DIR = $(ROOT)/src/$(MOD)
6TARGET = lib 7TARGET = lib
7 8
8include $(ROOT)/src/prog.mk 9include $(ROOT)/src/prog.mk
diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile
index c9e25d066..f66fdd0d7 100644
--- a/src/libpostexecseccomp/Makefile
+++ b/src/libpostexecseccomp/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/libpostexecseccomp 5MOD = libpostexecseccomp
6SO = libpostexecseccomp.so 6MOD_DIR = $(ROOT)/src/$(MOD)
7SO = $(MOD_DIR)/$(MOD).so
7TARGET = $(SO) 8TARGET = $(SO)
8 9
9EXTRA_HDRS = ../include/seccomp.h ../include/rundefs.h 10EXTRA_HDRS = ../include/seccomp.h ../include/rundefs.h
diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile
index 337529361..3493d1786 100644
--- a/src/libtrace/Makefile
+++ b/src/libtrace/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/libtrace 5MOD = libtrace
6SO = libtrace.so 6MOD_DIR = $(ROOT)/src/$(MOD)
7SO = $(MOD_DIR)/$(MOD).so
7TARGET = $(SO) 8TARGET = $(SO)
8 9
9include $(ROOT)/src/so.mk 10include $(ROOT)/src/so.mk
diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile
index 3e9d9e3e3..a83726167 100644
--- a/src/libtracelog/Makefile
+++ b/src/libtracelog/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/libtracelog 5MOD = libtracelog
6SO = libtracelog.so 6MOD_DIR = $(ROOT)/src/$(MOD)
7SO = $(MOD_DIR)/$(MOD).so
7TARGET = $(SO) 8TARGET = $(SO)
8 9
9EXTRA_HDRS = ../include/rundefs.h 10EXTRA_HDRS = ../include/rundefs.h
diff --git a/src/profstats/Makefile b/src/profstats/Makefile
index aa947401e..8f33ce1de 100644
--- a/src/profstats/Makefile
+++ b/src/profstats/Makefile
@@ -2,8 +2,9 @@
2ROOT = ../.. 2ROOT = ../..
3-include $(ROOT)/config.mk 3-include $(ROOT)/config.mk
4 4
5MOD_DIR = src/profstats 5MOD = profstats
6PROG = profstats 6MOD_DIR = $(ROOT)/src/$(MOD)
7PROG = $(MOD_DIR)/$(MOD)
7TARGET = $(PROG) 8TARGET = $(PROG)
8 9
9EXTRA_HDRS = ../include/common.h 10EXTRA_HDRS = ../include/common.h
diff --git a/src/prog.mk b/src/prog.mk
index b7ac59785..7797f56b6 100644
--- a/src/prog.mk
+++ b/src/prog.mk
@@ -5,8 +5,8 @@
5# The includer should probably define PROG and TARGET and may also want to 5# The includer should probably define PROG and TARGET and may also want to
6# define EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES. 6# define EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES.
7 7
8HDRS := $(sort $(wildcard *.h)) $(EXTRA_HDRS) 8HDRS := $(sort $(wildcard $(MOD_DIR)/*.h)) $(EXTRA_HDRS)
9SRCS := $(sort $(wildcard *.c)) 9SRCS := $(sort $(wildcard $(MOD_DIR)/*.c))
10OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS) 10OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS)
11 11
12.PHONY: all 12.PHONY: all
diff --git a/src/so.mk b/src/so.mk
index c1913b794..ceee9021f 100644
--- a/src/so.mk
+++ b/src/so.mk
@@ -5,8 +5,8 @@
5# The includer should probably define SO and TARGET and may also want to define 5# The includer should probably define SO and TARGET and may also want to define
6# EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES. 6# EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES.
7 7
8HDRS := $(sort $(wildcard *.h)) $(EXTRA_HDRS) 8HDRS := $(sort $(wildcard $(MOD_DIR)/*.h)) $(EXTRA_HDRS)
9SRCS := $(sort $(wildcard *.c)) 9SRCS := $(sort $(wildcard $(MOD_DIR)/*.c))
10OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS) 10OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS)
11 11
12.PHONY: all 12.PHONY: all