diff --git a/posix/Makefile b/posix/Makefile
index 7e4f252a40..3e7ca8e18c 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -22,145 +22,435 @@ subdir	:= posix
 
 include ../Makeconfig
 
-headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
-	   glob.h regex.h wordexp.h fnmatch.h 				      \
-	   getopt.h bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h  \
-	   bits/types.h bits/typesizes.h bits/pthreadtypes.h		      \
-	   bits/pthreadtypes-arch.h bits/thread-shared-types.h		      \
-	   bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h		      \
-	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
-	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
-	   bits/sched.h bits/cpu-set.h re_comp.h wait.h bits/environments.h   \
-	   cpio.h spawn.h bits/unistd.h bits/types/struct_sched_param.h	      \
-	   bits/unistd_ext.h bits/types/idtype_t.h bits/mman_ext.h
-
-routines :=								      \
-	uname								      \
-	times								      \
-	wait waitpid wait3 wait4 waitid					      \
-	alarm sleep pause nanosleep					      \
-	fork _Fork vfork _exit register-atfork				      \
-	execve fexecve execv execle execl execvp execlp execvpe		      \
-	getpid getppid							      \
-	getuid geteuid getgid getegid getgroups setuid setgid group_member    \
-	getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid	      \
-	getresuid getresgid setresuid setresgid				      \
-	pathconf sysconf fpathconf					      \
-	glob glob64 globfree globfree64 glob_pattern_p fnmatch regex	      \
-	glob-lstat-compat glob64-lstat-compat				      \
-	confstr								      \
-	getopt getopt1 							      \
-	sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax  \
-	sched_primin sched_rr_gi sched_getaffinity sched_setaffinity	      \
-	getaddrinfo gai_strerror wordexp				      \
-	pread pwrite pread64 pwrite64					      \
-	spawn_faction_init spawn_faction_destroy spawn_faction_addclose	      \
-	spawn_faction_addopen spawn_faction_adddup2 spawn_valid_fd	      \
-	spawn_faction_addchdir spawn_faction_addfchdir			      \
-	spawn_faction_addclosefrom					      \
-	spawn_faction_addtcsetpgrp_np					      \
-	spawnattr_init spawnattr_destroy				      \
-	spawnattr_getdefault spawnattr_setdefault			      \
-	spawnattr_getflags spawnattr_setflags				      \
-	spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni	      \
-	spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
-	spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
-	posix_madvise							      \
-	get_child_max sched_cpucount sched_cpualloc sched_cpufree \
-	streams-compat \
-	shm-directory                                                         \
-	execveat \
-	glob64-time64 \
-	globfree64-time64
-
-aux		:= init-posix environ
-tests		:= test-errno tstgetopt testfnm runtests runptests \
-		   tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
-		   tst-mmap tst-mmap-offset tst-getaddrinfo tst-truncate \
-		   tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
-		   tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
-		   tst-gnuglob tst-gnuglob64 tst-regex bug-regex6 bug-regex7 \
-		   bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
-		   bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
-		   bug-regex17 bug-regex18 bug-regex19 \
-		   bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
-		   bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
-		   bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
-		   tst-nice tst-nanosleep tst-regex2 \
-		   transbug tst-rxspencer tst-pcre tst-boost \
-		   bug-ga1 tst-vfork1 tst-vfork2 \
-		   tst-waitid tst-wait4 tst-wait3 \
-		   tst-getaddrinfo2 bug-glob2 bug-glob3 tst-sysconf \
-		   tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
-		   tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
-		   tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
-		   tst-execvp3 tst-execvp4 \
-		   tst-execvpe1 tst-execvpe2 tst-execvpe3 tst-execvpe4 \
-		   tst-execvpe5 tst-execvpe6 \
-		   tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
-		   bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
-		   bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
-		   tst-pathconf tst-rxspencer-no-utf8 \
-		   tst-fnmatch3 bug-regex36 \
-		   tst-fnmatch4 tst-fnmatch5 tst-fnmatch6 tst-fnmatch7 \
-		   tst-posix_spawn-fd tst-posix_spawn-setsid \
-		   tst-posix_fadvise tst-posix_fadvise64 \
-		   tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
-		   tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
-		   bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
-		   tst-wordexp-nocmd tst-execveat tst-spawn5 \
-		   tst-sched_getaffinity tst-spawn6 tst-spawn7
+headers	:= \
+  bits/confname.h \
+  bits/cpu-set.h \
+  bits/environments.h \
+  bits/getopt_core.h \
+  bits/getopt_ext.h \
+  bits/getopt_posix.h \
+  bits/local_lim.h \
+  bits/mman_ext.h \
+  bits/posix1_lim.h \
+  bits/posix2_lim.h \
+  bits/posix_opt.h \
+  bits/pthreadtypes-arch.h \
+  bits/pthreadtypes.h \
+  bits/sched.h \
+  bits/thread-shared-types.h \
+  bits/types.h \
+  bits/types/idtype_t.h \
+  bits/types/struct_sched_param.h \
+  bits/typesizes.h \
+  bits/unistd.h \
+  bits/unistd_ext.h \
+  bits/utsname.h \
+  bits/waitflags.h \
+  bits/waitstatus.h \
+  cpio.h \
+  fnmatch.h \
+  getopt.h \
+  glob.h \
+  re_comp.h \
+  regex.h \
+  sched.h \
+  spawn.h \
+  sys/times.h \
+  sys/types.h \
+  sys/unistd.h \
+  sys/utsname.h \
+  sys/wait.h \
+  tar.h \
+  unistd.h \
+  wait.h \
+  wordexp.h \
+  # headers
+
+routines := \
+  _Fork \
+  _exit \
+  alarm \
+  bsd-getpgrp \
+  confstr \
+  execl \
+  execle \
+  execlp \
+  execv \
+  execve \
+  execveat \
+  execvp \
+  execvpe \
+  fexecve \
+  fnmatch \
+  fork \
+  fpathconf \
+  gai_strerror \
+  get_child_max \
+  getaddrinfo \
+  getegid \
+  geteuid \
+  getgid \
+  getgroups \
+  getopt \
+  getopt1 \
+  getpgid \
+  getpgrp \
+  getpid \
+  getppid \
+  getresgid \
+  getresuid \
+  getsid \
+  getuid \
+  glob \
+  glob-lstat-compat \
+  glob64 \
+  glob64-lstat-compat \
+  glob64-time64 \
+  glob_pattern_p \
+  globfree \
+  globfree64 \
+  globfree64-time64 \
+  group_member \
+  nanosleep \
+  pathconf \
+  pause \
+  posix_madvise \
+  pread \
+  pread64 \
+  pwrite \
+  pwrite64 \
+  regex \
+  register-atfork \
+  sched_cpualloc \
+  sched_cpucount \
+  sched_cpufree \
+  sched_getaffinity \
+  sched_getp \
+  sched_gets \
+  sched_primax \
+  sched_primin \
+  sched_rr_gi \
+  sched_setaffinity \
+  sched_setp \
+  sched_sets \
+  sched_yield \
+  setgid \
+  setpgid \
+  setpgrp \
+  setresgid \
+  setresuid \
+  setsid \
+  setuid \
+  shm-directory \
+  sleep \
+  spawn \
+  spawn_faction_addchdir \
+  spawn_faction_addclose \
+  spawn_faction_addclosefrom \
+  spawn_faction_adddup2 \
+  spawn_faction_addfchdir \
+  spawn_faction_addopen \
+  spawn_faction_addtcsetpgrp_np \
+  spawn_faction_destroy \
+  spawn_faction_init \
+  spawn_valid_fd \
+  spawnattr_destroy \
+  spawnattr_getdefault \
+  spawnattr_getflags \
+  spawnattr_getpgroup \
+  spawnattr_getschedparam \
+  spawnattr_getschedpolicy \
+  spawnattr_getsigmask \
+  spawnattr_init \
+  spawnattr_setdefault \
+  spawnattr_setflags \
+  spawnattr_setpgroup \
+  spawnattr_setschedparam \
+  spawnattr_setschedpolicy \
+  spawnattr_setsigmask \
+  spawni \
+  spawnp \
+  streams-compat \
+  sysconf \
+  times \
+  uname \
+  vfork \
+  wait \
+  wait3 \
+  wait4 \
+  waitid \
+  waitpid \
+  wordexp \
+  # routines
+
+aux := \
+  environ \
+  init-posix \
+  #aux
+
+tests := \
+  bug-ga1 \
+  bug-getopt1 \
+  bug-getopt2 \
+  bug-getopt3 \
+  bug-getopt4 \
+  bug-getopt5 \
+  bug-glob2 \
+  bug-glob3 \
+  bug-regex1 \
+  bug-regex10 \
+  bug-regex11 \
+  bug-regex12 \
+  bug-regex13 \
+  bug-regex14 \
+  bug-regex15 \
+  bug-regex16 \
+  bug-regex17 \
+  bug-regex18 \
+  bug-regex19 \
+  bug-regex2 \
+  bug-regex21 \
+  bug-regex22 \
+  bug-regex23 \
+  bug-regex24 \
+  bug-regex25 \
+  bug-regex26 \
+  bug-regex27 \
+  bug-regex28 \
+  bug-regex29 \
+  bug-regex3 \
+  bug-regex30 \
+  bug-regex31 \
+  bug-regex32 \
+  bug-regex34 \
+  bug-regex35 \
+  bug-regex36 \
+  bug-regex37 \
+  bug-regex38 \
+  bug-regex4 \
+  bug-regex6 \
+  bug-regex7 \
+  bug-regex8 \
+  bug-regex9 \
+  regexbug1 \
+  runptests \
+  runtests \
+  test-errno \
+  test-ssize-max \
+  test-vfork \
+  testfnm \
+  transbug \
+  tst-boost \
+  tst-chmod \
+  tst-cpucount \
+  tst-cpuset \
+  tst-dir \
+  tst-execl1 \
+  tst-execl2 \
+  tst-execle1 \
+  tst-execle2 \
+  tst-execlp1 \
+  tst-execlp2 \
+  tst-execv1 \
+  tst-execv2 \
+  tst-execve1 \
+  tst-execve2 \
+  tst-execveat \
+  tst-execvp1 \
+  tst-execvp2 \
+  tst-execvp3 \
+  tst-execvp4 \
+  tst-execvpe1 \
+  tst-execvpe2 \
+  tst-execvpe3 \
+  tst-execvpe4 \
+  tst-execvpe5 \
+  tst-execvpe6 \
+  tst-fexecve \
+  tst-fnmatch \
+  tst-fnmatch2 \
+  tst-fnmatch3 \
+  tst-fnmatch4 \
+  tst-fnmatch5 \
+  tst-fnmatch6 \
+  tst-fnmatch7 \
+  tst-fork \
+  tst-getaddrinfo \
+  tst-getaddrinfo2 \
+  tst-getaddrinfo3 \
+  tst-getopt_long1 \
+  tst-glob-tilde \
+  tst-glob_symlinks \
+  tst-gnuglob \
+  tst-gnuglob64 \
+  tst-mmap \
+  tst-mmap-offset \
+  tst-nanosleep \
+  tst-nice \
+  tst-pathconf \
+  tst-pcre \
+  tst-posix_fadvise \
+  tst-posix_fadvise64 \
+  tst-posix_spawn-fd \
+  tst-posix_spawn-setsid \
+  tst-preadwrite \
+  tst-preadwrite64 \
+  tst-regcomp-truncated \
+  tst-regex \
+  tst-regex2 \
+  tst-regexloc \
+  tst-rxspencer \
+  tst-rxspencer-no-utf8 \
+  tst-sched_getaffinity \
+  tst-spawn-chdir \
+  tst-spawn4 \
+  tst-spawn5 \
+  tst-spawn6 \
+  tst-spawn7 \
+  tst-sysconf \
+  tst-sysconf-empty-chroot \
+  tst-truncate \
+  tst-truncate64 \
+  tst-vfork1 \
+  tst-vfork2 \
+  tst-wait3 \
+  tst-wait4 \
+  tst-waitid \
+  tst-wordexp-nocmd \
+  tstgetopt \
+  # tests
 
 # Test for the glob symbol version that was replaced in glibc 2.27.
 ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
-tests += tst-glob_lstat_compat
+tests += \
+  tst-glob_lstat_compat
+  # tests
 endif
 
 # Test for the posix_spawn, posix_spawnp symbol versions replaced in
 # glibc 2.15.
 ifeq ($(have-GLIBC_2.14)$(build-shared),yesyes)
-tests += tst-spawn4-compat
+tests += \
+  tst-spawn4-compat \
+  # tests
 endif
 
-tests-internal	:= bug-regex5 bug-regex20 bug-regex33 \
-		   tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3
-tests-container := bug-ga2 tst-vfork3
-tests-time64	:= tst-wait4-time64 tst-wait3-time64 tst-gnuglob64-time64
-xtests		:= tst-getaddrinfo4 tst-getaddrinfo5 tst-sched_rr_get_interval
-xtests-time64	:= tst-sched_rr_get_interval-time64
+tests-internal := \
+  bug-regex20 \
+  bug-regex33 \
+  bug-regex5 \
+  tst-rfc3484 \
+  tst-rfc3484-2 \
+  tst-rfc3484-3 \
+  # tests-internal
+
+tests-container := \
+  bug-ga2 \
+  tst-vfork3 \
+  # tests-container
+
+tests-time64 := \
+  tst-gnuglob64-time64 \
+  tst-wait3-time64 \
+  tst-wait4-time64 \
+  # tests-time64
+
+xtests	:= \
+  tst-getaddrinfo4 \
+  tst-getaddrinfo5 \
+  tst-sched_rr_get_interval \
+  # xtests
+
+xtests-time64 := \
+  tst-sched_rr_get_interval-time64 \
+  # xtests-time64
+
 ifeq (yes,$(build-shared))
-test-srcs	:= globtest
-tests           += wordexp-test tst-exec tst-spawn tst-spawn2 tst-spawn3
+test-srcs := \
+  globtest
+  # tests-src
+tests += \
+  tst-exec \
+  tst-spawn \
+  tst-spawn2 \
+  tst-spawn3 \
+  wordexp-test \
+  # tests
 endif
+
 ifeq (yesyes,$(build-shared)$(have-thread-library))
-tests		+= tst-getopt-cancel tst-_Fork
+tests += \
+  tst-_Fork \
+  tst-getopt-cancel \
+  # tests
 endif
-tests-static	= tst-exec-static tst-spawn-static
-tests		+= $(tests-static)
-others		:= getconf
-install-bin	:= getconf
-install-others-programs	:= $(inst_libexecdir)/getconf
 
-before-compile	+= $(objpfx)posix-conf-vars-def.h
+tests-static = \
+  tst-exec-static \
+  tst-spawn-static \
+  # tests-static
+
+tests += \
+  $(tests-static)
+  # tests
+
+others := \
+  getconf \
+  # others
+
+install-bin := \
+  getconf \
+  # getconf
+
+install-others-programs	:= \
+  $(inst_libexecdir)/getconf \
+  # install-others-programs
+
+before-compile += \
+  $(objpfx)posix-conf-vars-def.h \
+  # before-compile
 
 # So they get cleaned up.
-generated += $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
-	     annexc annexc.out wordexp-tst.out bug-regex2-mem.out \
-	     bug-regex2.mtrace bug-regex14-mem.out bug-regex14.mtrace \
-	     bug-regex21-mem.out bug-regex21.mtrace \
-	     bug-regex31-mem.out bug-regex31.mtrace \
-	     tst-rxspencer-no-utf8-mem.out tst-rxspencer-no-utf8.mtrace \
-	     tst-getconf.out \
-	     tst-pcre-mem.out tst-pcre.mtrace tst-boost-mem.out \
-	     tst-boost.mtrace bug-ga2.mtrace bug-ga2-mem.out \
-	     bug-glob2.mtrace bug-glob2-mem.out tst-vfork3-mem.out \
-	     tst-vfork3.mtrace getconf.speclist tst-fnmatch-mem.out \
-	     tst-fnmatch.mtrace bug-regex36.mtrace \
-	     testcases.h ptestcases.h
+generated += \
+  $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
+  annexc \
+  annexc.out \
+  bug-ga2-mem.out \
+  bug-ga2.mtrace \
+  bug-glob2-mem.out \
+  bug-glob2.mtrace \
+  bug-regex14-mem.out \
+  bug-regex14.mtrace \
+  bug-regex2-mem.out \
+  bug-regex2.mtrace \
+  bug-regex21-mem.out \
+  bug-regex21.mtrace \
+  bug-regex31-mem.out \
+  bug-regex31.mtrace \
+  bug-regex36.mtrace \
+  getconf.speclist \
+  ptestcases.h \
+  testcases.h \
+  tst-boost-mem.out \
+  tst-boost.mtrace \
+  tst-fnmatch-mem.out \
+  tst-fnmatch.mtrace \
+  tst-getconf.out \
+  tst-pcre-mem.out \
+  tst-pcre.mtrace \
+  tst-rxspencer-no-utf8-mem.out \
+  tst-rxspencer-no-utf8.mtrace \
+  tst-vfork3-mem.out \
+  tst-vfork3.mtrace \
+  wordexp-tst.out \
+  # generated
 
 ifeq ($(run-built-tests),yes)
 ifeq (yes,$(build-shared))
-tests-special += $(objpfx)globtest.out $(objpfx)wordexp-tst.out
+tests-special += \
+  $(objpfx)globtest.out \
+  $(objpfx)wordexp-tst.out \
+  # tests-special
 endif
 endif
 
@@ -168,13 +458,22 @@ endif
 # XXX Please note that for now we ignore the result of this test.
 tests-special += $(objpfx)annexc.out
 ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \
-		 $(objpfx)bug-regex21-mem.out $(objpfx)bug-regex31-mem.out \
-		 $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \
-		 $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \
-		 $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \
-		 $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out \
-		 $(objpfx)tst-glob-tilde-mem.out $(objpfx)bug-ga2-mem.out
+tests-special += \
+  $(objpfx)bug-ga2-mem.out \
+  $(objpfx)bug-glob2-mem.out \
+  $(objpfx)bug-regex14-mem.out \
+  $(objpfx)bug-regex2-mem.out \
+  $(objpfx)bug-regex21-mem.out \
+  $(objpfx)bug-regex31-mem.out \
+  $(objpfx)bug-regex36-mem.out \
+  $(objpfx)tst-boost-mem.out \
+  $(objpfx)tst-fnmatch-mem.out \
+  $(objpfx)tst-getconf.out \
+  $(objpfx)tst-glob-tilde-mem.out \
+  $(objpfx)tst-pcre-mem.out \
+  $(objpfx)tst-rxspencer-no-utf8-mem.out \
+  $(objpfx)tst-vfork3-mem.out \
+  # tests-special
 endif
 
 include ../Rules
