lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <6bb9c1030701150135x173f95c0lb67247b641137367@mail.gmail.com>
Date:	Mon, 15 Jan 2007 10:35:25 +0100
From:	"Pelle Svensson" <pelle2004@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	"Sam Ravnborg" <sam@...nborg.org>
Subject: Skeleton, Makefile extension - Separate source tree with only valid source files

Did some hacks to the Makefile which might be of interest for those who
feel like there are too many source files in the Linux tree. Running following
make will create a separate directory including only the files which are
active i.e. they are include in the final build configuration.

source = /home/john/src/linux-2.6.20
build_dir = /home/john/src/linux-2.6.20-build
edit_dir = /home/john/src/linux-2.6.20-edit

cd $(source)
make O=$(build_dir) ACTIVE_SRC=$(edit_dir) active_srctree

Links will be create in $(edit_dir) and what ever IDE that are in use for
editing should target the $(edit_dir). The good thing is that grep will only
hit valid files not 50 other files which are not in my interest.


Due to lack of time this is not complete. Phrasing the dependency need to
be added for all the include files.


Part added to root Makefile
==================

# Generate source tree with only active files based on the configuration
# ---------------------------------------------------------------------------

ifneq ($(ACTIVE_SRCTREE),)
edittree	:= $(ACTIVE_SRCTREE)
edittree-alldir	:= $(subst usr,,$(vmlinux-alldirs))
edittree-alldir	:= $(addprefix $(edittree)/, $(edittree-alldir) )
endif

PHONY += active_srctree validate_active_srctree $(edittree-alldir)

validate_active_srctree:
	$(if $(ACTIVE_SRCTREE),, $(error Must define ACTIVE_SRCTREE=...))
	
$(edittree-alldir):
	$(Q) $(MAKE) -f $(srctree)/scripts/Makefile.srctree
edittree=$(edittree) srctree=$(srctree) dst=$@

active_srctree: validate_active_srctree $(edittree-alldir)


New file created scripts/Makefile.srctree
============================

# ==========================================================================
# Building a source tree consisting of links into main source.
# Links are only created for files currently in use by the configuration
# ==========================================================================

#src := $(src)
sdir := $(subst $(edittree)/,,$(dst))
sdir := $(subst %/,%,$(sdir))

PHONY := link
link:

# Read .config if it exist, otherwise ignore
-include include/config/auto.conf

include $(srctree)/scripts/Kbuild.include

include $(srctree)/$(sdir)/Makefile

__subdir-y	:= $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y	+= $(__subdir-y)
__subdir-m	:= $(patsubst %/,%,$(filter %/, $(obj-m)))
subdir-m	+= $(__subdir-m)

subdir-ym	:= $(sort $(subdir-y) $(subdir-m))
subdir-ym	:= $(addprefix $(sdir)/, $(subdir-ym))

obj-y		:= $(filter-out %/, $(obj-y))
obj-m		:= $(filter-out %/, $(obj-m))

obj-names := $(patsubst %.o,%,$(obj-y) $(obj-m) $(head-y))
obj-names := $(filter-out /% , $(obj-names))
src-files := $(addprefix $(srctree)/$(sdir)/, $(obj-names))
src-files := $(wildcard $(addsuffix .*, $(src-files)))
dst-files := $(subst $(srctree)/,,$(src-files))
dst-files := $(addprefix $(edittree)/, $(dst-files))

link: $(dst-files) $(subdir-ym)

$(dst-files): $(edittree)/%: $(srctree)/%
	$(Q) mkdir -p $(@D)
	$(Q) if test -f $@; then touch $@; else cp -l $< $@; fi

# Descending
# ---------------------------------------------------------------------------

PHONY += $(subdir-ym)
$(subdir-ym):
	$(Q) $(MAKE) -f $(srctree)/scripts/Makefile.srctree
edittree=$(edittree) srctree=$(srctree) dst=$@

# ---------------------------------------------------------------------------

.PHONY: $(PHONY)

# ---------------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ