lobase

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

commit 78ce17ddcd7d19b6adde4ea02f5672a0a5114b47
parent f775ceff014b779684d44542b467436b42106424
Author: Duncaen <mail@duncano.de>
Date:   Mon,  6 Mar 2017 23:32:31 +0100

mk: updates

Diffstat:
mk/bsd.lib.mk | 65++++++++++++++++++++++++++++++++++++++---------------------------
mk/bsd.man.mk | 0
mk/bsd.prog.mk | 24++++++++++--------------
mk/bsd.regress.mk | 5+++--
mk/bsd.subdir.mk | 9+++++----
5 files changed, 56 insertions(+), 47 deletions(-)

diff --git a/mk/bsd.lib.mk b/mk/bsd.lib.mk @@ -1,28 +1,23 @@ -include config.mk - STATICLIB = lib$(LIB).a +LIBDIR=/lib +BINOWN=root +BINGRP=root +LIBOWN=$(BINOWN) +LIBGRP=$(BINGRP) .CURDIR = . -CLEANFILES += $(STATICLIB) *.o -CPPFLAGS += -I$(TOPDIR)/libopenbsd -include openbsd.h -I$(TOPDIR) -include config.h +CPPFLAGS += -I$(TOPDIR)/lib/libopenbsd -include openbsd.h -I$(TOPDIR)/include \ + -I$(TOPDIR) -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 +OBJS += $(YFILES:.y=.o) +OBJS += $(LFILES:.l=.o) +OBJS += $(CFILES:.c=.o) .DEFAULT_GOAL := @@ -34,11 +29,6 @@ else $(STATICLIB) : % : %.o endif -$(STATICLIB) : ../../libopenbsd/libopenbsd.a - -../../libopenbsd/libopenbsd.a: - $(MAKE) -C ../../libopenbsd libopenbsd.a - y.tab.h y.tab.c: $(YACC) -d $< @@ -46,19 +36,40 @@ y.tab.h y.tab.c: $(CC) $(CFLAGS) $(CPPFLAGS) -c y.tab.c -o $@ %.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(STATICLIB): - $(AR) rc $@ $^ + rm -f $@ + $(AR) rc $@ $(OBJS) + $(RANLIB) $@ -clean: +clean: _SUBDIRUSE + rm -f $(STATICLIB) $(OBJS) +ifdef CLEANFILES rm -f $(CLEANFILES) +endif + +cleandir: _SUBDIRUSE clean -install: libinstall +beforeinstall: -libinstall: +realinstall: test -d "$(DESTDIR)$(LIBDIR)" || \ $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR) - $(INSTALL) $(STATICLIB) $(DESTDIR)$(LIBDIR)/$(STATICLIB) + $(INSTALL) -m 600 $(STATICLIB) \ + $(DESTDIR)$(LIBDIR) + +install: maninstall _SUBDIRUSE +maninstall: afterinstall +afterinstall: realinstall +realinstall: beforeinstall + -.PHONY: all clean install libinstall +.PHONY: all clean cleandir install libinstall + +ifndef NOMAN +include bsd.man.mk +endif + +include bsd.subdir.mk +include config.mk diff --git a/mk/bsd.man.mk b/mk/bsd.man.mk diff --git a/mk/bsd.prog.mk b/mk/bsd.prog.mk @@ -3,14 +3,15 @@ include config.mk .CURDIR = . CLEANFILES += $(PROG) *.o -CPPFLAGS += -I../../libopenbsd -include openbsd.h -I../.. -include config.h -LDFLAGS += $(LDADD) +CPPFLAGS += -I$(TOPDIR)/lib/libopenbsd -include openbsd.h -I$(TOPDIR) -include config.h -#find_src = $(wildcard $(src) $(.PATH:%=%/$(src))) -#SRCS := $(foreach src,$(SRCS),$(find_src)) -ifneq (,$(.PATH)) - VPATH := $(.PATH) +LIBC ?= $(TOPDIR)/lib/libopenbsd/libopenbsd.a +LIBUTIL ?= $(TOPDIR)/lib/libutil/libutil.a + +ifeq (-lutil,$(filter -lutil,$(LDADD))) + LDFLAGS+= -L$(TOPDIR)/lib/libutil endif +LDFLAGS += -L$(TOPDIR)/lib/libopenbsd $(LDADD) -lopenbsd CFILES = $(filter %.c,$(SRCS)) YFILES = $(filter %.y,$(SRCS)) @@ -32,13 +33,8 @@ else $(PROG) : % : %.o endif -$(PROG) : ../../libopenbsd/libopenbsd.a - -../../libopenbsd/libopenbsd.a: - $(MAKE) -C ../../libopenbsd libopenbsd.a - y.tab.h y.tab.c: - $(YACC) -d $< + $(YACC) -d $(YFILES) %.o: %.y y.tab.c $(CC) $(CFLAGS) $(CPPFLAGS) -c y.tab.c -o $@ @@ -47,10 +43,10 @@ y.tab.h y.tab.c: $(CC) $(CFLAGS) $(CPPFLAGS) -c $< $(PROG): - $(CC) $^ ../../libopenbsd/libopenbsd.a -o $@ $(LDFLAGS) + $(CC) $^ -o $@ $(LDFLAGS) clean: - rm -f $(CLEANFILES) + rm -f $(CLEANFILES) y.tab.h y.tab.c install: proginstall install_links diff --git a/mk/bsd.regress.mk b/mk/bsd.regress.mk @@ -1,5 +1,3 @@ -include ../../../config.mk - .CURDIR = . .OBJDIR = $(shell pwd) .DEFAULT_GOAL := @@ -20,3 +18,6 @@ ifneq (,$(CLEANFILES)) endif .PHONY: all clean regress depend + +.SUFFIXES: +include config.mk diff --git a/mk/bsd.subdir.mk b/mk/bsd.subdir.mk @@ -1,5 +1,5 @@ SUBDIR_MFLAGS = -I$(TOPDIR) -I$(TOPDIR)/mk -SUBDIR_TARGETS = all clean cleandir includes depend obj tags manlint +SUBDIR_TARGETS = all install clean cleandir includes depend obj tags manlint SKIPDIR ?= $(SUBDIR_TARGETS): _SUBDIRUSE @@ -10,9 +10,10 @@ ifneq (,$(SUBDIR)) skip=; for s in $(SKIPDIR); do \ [ "$$s" = "$$d" ] && skip=1; \ done; \ - [ "$$skip" ] && echo "($$d skipped)" && continue; \ - echo "===> $$d"; \ - $(MAKE) $(SUBDIR_MFLAGS) -C $$d $(MAKECMDGOALS) || exit 1; \ + [ -n "$$_THISDIR_" ] && n="$$_THISDIR_/$$d" || n=$$d; \ + [ "$$skip" ] && echo "($$n skipped)" && continue; \ + echo "===> $$n"; \ + $(MAKE) $(SUBDIR_MFLAGS) -C $$d _THISDIR_=$$n $(MAKECMDGOALS) || exit 1; \ done $(SUBDIR):