From 904d68cd1f7394b1c3cb6f0b67651aa4fbee5e62 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 15 Aug 2018 18:30:59 -0600 Subject: [PATCH] apps/builtin/Makefile. This commit changes apps/builtin to search the registry recursively. By supporting directories, external projects can install the hooks into the registry and easily clean them up and reinstall if something needs to be updated. Based on an idea from Anthony Merlino. --- builtin/Makefile | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/builtin/Makefile b/builtin/Makefile index 211569452..73d0ba572 100644 --- a/builtin/Makefile +++ b/builtin/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/builtin/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012, 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -60,9 +60,20 @@ endif ROOTDEPPATH = --dep-path . VPATH = +# RWILDCARD - Recursive wildcard used to get lists of files + +define RWILDCARD + $(foreach d,$(wildcard $1/*),$(call RWILDCARD,$d/)$(filter $(subst *,%,$2),$d)) +endef + +# Registry entry lists + +PDATLIST = $(call RWILDCARD, registry, *.pdat) +BDATLIST = $(call RWILDCARD, registry, *.bdat) + # Build Targets -all: .built +all: .built .PHONY: context depend clean distclean preconfig .PRECIOUS: ../libapps$(LIBEXT) @@ -80,31 +91,13 @@ builtin_list$(OBJEXT): builtin_list.h builtin_proto.h builtin_list.h: registry$(DELIM).updated $(call DELFILE, .xx_builtin_list.h) $(Q) touch .xx_builtin_list.h -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) (for /f %%G in ('dir /b registry\*.bdat') do ( type registry\%%G >> .xx_builtin_list.h )) || echo "" -else - $(Q) ( \ - filelist=`ls registry/*.bdat 2>/dev/null || echo ""`; \ - for file in $$filelist; \ - do cat $$file >> .xx_builtin_list.h; \ - done; \ - ) -endif + $(call CATFILE, .xx_builtin_list.h, $(BDATLIST)) $(Q) mv .xx_builtin_list.h builtin_list.h builtin_proto.h: registry$(DELIM).updated $(call DELFILE, .xx_builtin_proto.h) $(Q) touch .xx_builtin_proto.h -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) (for /f %%G in ('dir /b registry\*.pdat') do ( type registry\%%G >> .xx_builtin_proto.h )) || echo "" -else - $(Q) ( \ - filelist=`ls registry/*.pdat 2>/dev/null || echo ""`; \ - for file in $$filelist; \ - do cat $$file >> .xx_builtin_proto.h; \ - done; \ - ) -endif + $(call CATFILE, .xx_builtin_proto.h, $(PDATLIST)) $(Q) mv .xx_builtin_proto.h builtin_proto.h .built: $(OBJS)