lobase

Linux port of OpenBSDs userland.
Log | Files | Refs | README

commit 7ca84b835a6c2399a9619415db625117914594e9
parent 3d02c2e2dd2a34873573d720e32893efad6147e2
Author: Duncaen <mail@duncano.de>
Date:   Sat,  4 Mar 2017 23:42:12 +0100

fix makefiles

Diffstat:
Makefile | 25++++++++++++++++---------
bin/Makefile | 14+++-----------
bsd.prog.mk | 78------------------------------------------------------------------------------
bsd.regress.mk | 16----------------
mk/bsd.prog.mk | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mk/bsd.regress.mk | 17+++++++++++++++++
mk/bsd.subdir.mk | 12++++++++++++
regress/Makefile | 11++++-------
regress/bin/Makefile | 9++-------
regress/sbin/Makefile | 9++-------
regress/usr.bin/Makefile | 11+++--------
regress/usr.bin/tail/Makefile | 12++++--------
regress/usr.sbin/Makefile | 9++-------
sbin/Makefile | 4++--
usr.bin/Makefile | 19+++++++------------
usr.sbin/Makefile | 5+++--
16 files changed, 155 insertions(+), 174 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,15 +1,22 @@ -SUBDIRS = libopenbsd bin sbin usr.bin usr.sbin +MAKEFLAGS += -I$(shell pwd)/mk -all: - -clean: - PATH=$$PWD/dest/bin/:$$PATH $(MAKE) -I$(SRCDIR) -C regress clean +SUBDIR = libopenbsd bin sbin usr.bin usr.sbin -check: - PATH=$$PWD/dest/bin/:$$PATH $(MAKE) -I$(SRCDIR) -C regress SRCDIR=$(SRCDIR) SHELL=/bin/oksh +ifeq (clean,$(filter clean,$(MAKECMDGOALS))) +SUBDIR += regress +endif +all: +clean: insteall: -include mk/subdirs.mk +regression-tests: + @echo "Running regression tests..." \ + && export PATH=$$PWD/dest/bin/:$$PATH SHELL=/bin/oksh \ + && cd regress \ + && $(MAKE) depend \ + && exec $(MAKE) regress + +.PHONY: all clean install regression-tests -.PHONY: all clean check install +include mk/bsd.subdir.mk diff --git a/bin/Makefile b/bin/Makefile @@ -1,12 +1,4 @@ -SUBDIRS = cat chmod cp date dd df domainname echo ed expr hostname kill ln ls \ - md5 mkdir mv pax pwd rm rmdir sleep stty sync test - +SUBDIR = cat chmod cp date dd df domainname echo ed expr hostname kill ln ls \ + md5 mkdir mv pax pwd rm rmdir sleep stty sync test BROKEN = df - -all: - -include ../mk/subdirs.mk - -$(BROKEN): - @echo "skipping $@" - @true +include bsd.subdir.mk diff --git a/bsd.prog.mk b/bsd.prog.mk @@ -1,78 +0,0 @@ -include ../../config.mk - -.CURDIR = . -CLEANFILES += $(PROG) *.o - -CPPFLAGS += -I../../libopenbsd -include openbsd.h -I../.. -include config.h -LDFLAGS += $(LDADD) - -#find_src = $(wildcard $(src) $(.PATH:%=%/$(src))) -#SRCS := $(foreach src,$(SRCS),$(find_src)) -ifneq (,$(.PATH)) - VPATH := $(.PATH) -endif - -CFILES = $(filter %.c,$(SRCS)) -YFILES = $(filter %.y,$(SRCS)) -LFILES = $(filter %.l,$(SRCS)) - -OBJS = $(YFILES:.y=.o) $(LFILES:.l=.o) $(CFILES:.c=.o) - -ifneq (,$(findstring $(.DEFAULT_GOAL),install beforeinstall afterinstall)) - .DEFAULT_GOAL := -endif - -.DEFAULT_GOAL := - -all: $(PROG) - -ifdef SRCS -$(PROG) : $(OBJS) -else -$(PROG) : % : %.o -endif - -$(PROG) : ../../libopenbsd/libopenbsd.a - -../../libopenbsd/libopenbsd.a: - $(MAKE) -C ../../libopenbsd libopenbsd.a - -y.tab.h y.tab.c: - $(YACC) -d $< - -%.o: %.y y.tab.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c y.tab.c -o $@ - -%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $< - -$(PROG): - $(CC) $^ ../../libopenbsd/libopenbsd.a -o $@ $(LDFLAGS) - -clean: - rm -f $(CLEANFILES) - -install: proginstall install_links - -proginstall: -ifneq (,$(PROG)) - @test -d "$(DESTDIR)$(BINDIR)" || \ - $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) - @$(INSTALL) $(PROG) $(DESTDIR)$(BINDIR)/$(PROG_NAME) -endif - -install_links: -ifneq (,$(LINKS)) - @set -- $(LINKS); \ - while test $$# -ge 2; do \ - l=$(DESTDIR)$$1; shift; \ - t=$(DESTDIR)$$1; shift; \ - echo "$$t -> $$l"; \ - mkdir -p $$(dirname $$t); \ - rm -f $$t; \ - ln -s $$l $$t; \ - done - -endif - -.PHONY: all clean install proginstall diff --git a/bsd.regress.mk b/bsd.regress.mk @@ -1,16 +0,0 @@ -include ../../../config.mk - -.CURDIR = . -.OBJDIR = $(shell pwd) -.DEFAULT_GOAL := - -all: regress - -regress: -ifneq (,$(REGESS_TARGETS)) - for t in $(REGRESS_TARGETS); do \ - $(MAKE) $$t; \ - done -endif - -.PHONY: all clean diff --git a/mk/bsd.prog.mk b/mk/bsd.prog.mk @@ -0,0 +1,78 @@ +include ../../config.mk + +.CURDIR = . +CLEANFILES += $(PROG) *.o + +CPPFLAGS += -I../../libopenbsd -include openbsd.h -I../.. -include config.h +LDFLAGS += $(LDADD) + +#find_src = $(wildcard $(src) $(.PATH:%=%/$(src))) +#SRCS := $(foreach src,$(SRCS),$(find_src)) +ifneq (,$(.PATH)) + VPATH := $(.PATH) +endif + +CFILES = $(filter %.c,$(SRCS)) +YFILES = $(filter %.y,$(SRCS)) +LFILES = $(filter %.l,$(SRCS)) + +OBJS = $(YFILES:.y=.o) $(LFILES:.l=.o) $(CFILES:.c=.o) + +ifneq (,$(findstring $(.DEFAULT_GOAL),install beforeinstall afterinstall)) + .DEFAULT_GOAL := +endif + +.DEFAULT_GOAL := + +all: $(PROG) + +ifdef SRCS +$(PROG) : $(OBJS) +else +$(PROG) : % : %.o +endif + +$(PROG) : ../../libopenbsd/libopenbsd.a + +../../libopenbsd/libopenbsd.a: + $(MAKE) -C ../../libopenbsd libopenbsd.a + +y.tab.h y.tab.c: + $(YACC) -d $< + +%.o: %.y y.tab.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c y.tab.c -o $@ + +%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + +$(PROG): + $(CC) $^ ../../libopenbsd/libopenbsd.a -o $@ $(LDFLAGS) + +clean: + rm -f $(CLEANFILES) + +install: proginstall install_links + +proginstall: +ifneq (,$(PROG)) + @test -d "$(DESTDIR)$(BINDIR)" || \ + $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) + @$(INSTALL) $(PROG) $(DESTDIR)$(BINDIR)/$(PROG_NAME) +endif + +install_links: +ifneq (,$(LINKS)) + @set -- $(LINKS); \ + while test $$# -ge 2; do \ + l=$(DESTDIR)$$1; shift; \ + t=$(DESTDIR)$$1; shift; \ + echo "$$t -> $$l"; \ + mkdir -p $$(dirname $$t); \ + rm -f $$t; \ + ln -s $$l $$t; \ + done + +endif + +.PHONY: all clean install proginstall diff --git a/mk/bsd.regress.mk b/mk/bsd.regress.mk @@ -0,0 +1,17 @@ +include ../../../config.mk + +.CURDIR = . +.OBJDIR = $(shell pwd) +.DEFAULT_GOAL := + +all: depend regress +depend: + +regress: +ifneq (,$(REGESS_TARGETS)) + for t in $(REGRESS_TARGETS); do \ + $(MAKE) $$t; \ + done +endif + +.PHONY: all clean diff --git a/mk/bsd.subdir.mk b/mk/bsd.subdir.mk @@ -0,0 +1,12 @@ +SUBDIR_TARGETS = all clean install depend regress +SRCDIR = $(shell pwd) + +$(SUBDIR_TARGETS): $(SUBDIR) + +$(SUBDIR): + cd $@ && $(MAKE) $(filter-out $@,$(MAKECMDGOALS)) + +$(BROKEN): + @echo "skipping $@" + +.PHONY: all clean install $(SUBDIR) diff --git a/regress/Makefile b/regress/Makefile @@ -1,8 +1,5 @@ -SUBDIRS = bin sbin usr.bin usr.sbin - +SUBDIR = bin sbin usr.bin usr.sbin BROKEN = - -include ../mk/subdirs.mk - -$(BROKEN): - true +depend: +.PHONY: depend +include bsd.subdir.mk diff --git a/regress/bin/Makefile b/regress/bin/Makefile @@ -1,8 +1,3 @@ -SUBDIRS = cat chmod ln md5 pax test - +SUBDIR = cat chmod ln md5 pax test BROKEN = - -include ../../mk/subdirs.mk - -$(BROKEN): - true +include bsd.subdir.mk diff --git a/regress/sbin/Makefile b/regress/sbin/Makefile @@ -1,8 +1,3 @@ -SUBDIRS = - +SUBDIR = BROKEN = - -include ../../mk/subdirs.mk - -$(BROKEN): - true +include bsd.subdir.mk diff --git a/regress/usr.bin/Makefile b/regress/usr.bin/Makefile @@ -1,9 +1,4 @@ -SUBDIRS = bc calendar colrm column cut dc diff diff3 dirname file \ - fmt fold grep jot tail tsort ul wc xargs - +SUBDIR = bc calendar colrm column cut dc diff diff3 dirname file \ + fmt fold grep jot tail tsort ul wc xargs BROKEN = grep bc calendar diff3 - -include ../../mk/subdirs.mk - -$(BROKEN): - true +include bsd.subdir.mk diff --git a/regress/usr.bin/tail/Makefile b/regress/usr.bin/tail/Makefile @@ -6,14 +6,10 @@ REGRESS_TARGETS+= forward-blocks-rprint forward-chars-rprint forward-lines-rprin REGRESS_TARGETS+= reverse-blocks-rprint reverse-chars-rprint reverse-lines-rprint REGRESS_ROOT_TARGETS = follow-newsyslog -.for t in ${REGRESS_ROOT_TARGETS} -${t}: - ${SUDO} sh ${.CURDIR}/${t}.sh -.endfor +$(REGRESS_ROOT_TARGETS): + $(SUDO) $(SHELL) $@.sh -.for t in ${REGRESS_TARGETS} -${t}: - sh ${.CURDIR}/${t}.sh -.endfor +$(REGRESS_TARGETS): + $(SHELL) $@.sh include bsd.regress.mk diff --git a/regress/usr.sbin/Makefile b/regress/usr.sbin/Makefile @@ -1,8 +1,3 @@ -SUBDIRS = - +SUBDIR = BROKEN = - -include ../../mk/subdirs.mk - -$(BROKEN): - true +include bsd.subdir.mk diff --git a/sbin/Makefile b/sbin/Makefile @@ -1,3 +1,3 @@ -SUBDIRS = mknod +SUBDIR = mknod -include ../mk/subdirs.mk +include bsd.subdir.mk diff --git a/usr.bin/Makefile b/usr.bin/Makefile @@ -1,14 +1,9 @@ # dc before bc because it depends on dc.o -SUBDIRS = apply awk basename dc bc biff cal calendar cmp colrm col column comm cut \ - dirname du diff3 diff env expand false fmt fold getopt grep head hexdump id \ - indent join jot lam lndir logger logname look mktemp nice nl nohup \ - paste patch printenv printf readlink renice rev rs sed shar sort \ - split stat tee time touch tr true tty uname unexpand uniq unvis \ - uudecode uuencode vis wc what which xinstall - +SUBDIR = apply awk basename dc bc biff cal calendar cmp colrm col column comm \ + cut dirname du diff3 diff env expand false fmt fold getopt grep head \ + hexdump id indent join jot lam lndir logger logname look mktemp nice \ + nl nohup paste patch printenv printf readlink renice rev rs sed shar \ + sort split stat tee time touch tr true tty uname unexpand uniq unvis \ + uudecode uuencode vis wc what which xinstall BROKEN = sed - -include ../mk/subdirs.mk - -$(BROKEN): - true +include bsd.subdir.mk diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile @@ -1,2 +1,3 @@ -SUBDIRS = mtree rdate -include ../mk/subdirs.mk +SUBDIR = mtree rdate + +include bsd.subdir.mk