build: add stpd.lib.mk
This commit is contained in:
parent
a79916574a
commit
b2178714f7
7 changed files with 63 additions and 93 deletions
4
Makefile
4
Makefile
|
@ -23,7 +23,7 @@ BUILD_RULES := build-tools .WAIT
|
||||||
BUILD_RULES += includes-kernel includes-include includes-lib .WAIT
|
BUILD_RULES += includes-kernel includes-include includes-lib .WAIT
|
||||||
BUILD_RULES += build-user build-kernel
|
BUILD_RULES += build-user build-kernel
|
||||||
|
|
||||||
USER_RULES := install-bin install-sbin
|
USER_RULES := install-lib .WAIT install-bin install-sbin
|
||||||
KERNEL_RULES := install-boot install-kernel install-modules
|
KERNEL_RULES := install-boot install-kernel install-modules
|
||||||
|
|
||||||
IMAGES = stupid.iso stupid.hdd floppy1440.img floppy2880.img
|
IMAGES = stupid.iso stupid.hdd floppy1440.img floppy2880.img
|
||||||
|
@ -56,7 +56,7 @@ build-user: $(USER_RULES)
|
||||||
build-kernel: $(KERNEL_RULES)
|
build-kernel: $(KERNEL_RULES)
|
||||||
|
|
||||||
$(eval $(foreach X,kernel include lib,$(call subdir-rule,includes,$X)))
|
$(eval $(foreach X,kernel include lib,$(call subdir-rule,includes,$X)))
|
||||||
$(eval $(foreach X,bin sbin,$(call subdir-rule,install,$X)))
|
$(eval $(foreach X,lib bin sbin,$(call subdir-rule,install,$X)))
|
||||||
$(eval $(foreach X,boot kernel modules,$(call subdir-rule,install,$X)))
|
$(eval $(foreach X,boot kernel modules,$(call subdir-rule,install,$X)))
|
||||||
|
|
||||||
.PHONY: stupid.tar.gz
|
.PHONY: stupid.tar.gz
|
||||||
|
|
|
@ -1,27 +1,5 @@
|
||||||
LIBS = libc.a
|
LIB = c
|
||||||
OBJS = ctype.o
|
OBJS = ctype.o
|
||||||
INCS = stddef.h time.h ctype.h
|
INCS = stddef.h time.h ctype.h
|
||||||
|
|
||||||
INST = $(addprefix $(DESTDIR)$(INCDIR)/, $(INCS)) \
|
include stpd.lib.mk
|
||||||
$(addprefix $(DESTDIR)$(LIBDIR)/, $(LIBS))
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: $(LIBS)
|
|
||||||
|
|
||||||
$(LIBS): $(OBJS)
|
|
||||||
$(AR) rcs $@ $^
|
|
||||||
|
|
||||||
%.o: %.asm
|
|
||||||
$(AS) $< $@
|
|
||||||
|
|
||||||
$(DESTDIR)$(LIBDIR)/%.a: %.a
|
|
||||||
install -D $< $@
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
$(RM) $(LIBS) $(OBJS)
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: $(INST)
|
|
||||||
|
|
||||||
include stpd.inc.mk
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
LIBS = libcrypto.a
|
LIB = crypto
|
||||||
OBJS = sha2/sha256.o sha2/sha512.o \
|
OBJS = sha2/sha256.o sha2/sha512.o \
|
||||||
chacha/chacha.o \
|
chacha/chacha.o \
|
||||||
hchacha/hchacha.o
|
hchacha/hchacha.o
|
||||||
|
@ -12,26 +12,4 @@ ASMINCS = sha2/sha2.inc \
|
||||||
chacha/chacha.inc \
|
chacha/chacha.inc \
|
||||||
hchacha/hchacha.inc
|
hchacha/hchacha.inc
|
||||||
|
|
||||||
INST = $(addprefix $(DESTDIR)$(LIBDIR)/, $(LIBS))
|
include stpd.lib.mk
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: $(LIBS)
|
|
||||||
|
|
||||||
$(LIBS): $(OBJS)
|
|
||||||
$(AR) rcs $@ $^
|
|
||||||
|
|
||||||
%.o: %.asm
|
|
||||||
$(AS) $< $@
|
|
||||||
|
|
||||||
|
|
||||||
$(DESTDIR)$(LIBDIR)/%.a: %.a
|
|
||||||
install -D $< $@
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
$(RM) $(LIBS) $(OBJS)
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: $(INST)
|
|
||||||
|
|
||||||
include stpd.inc.mk
|
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
LIBS = crt0.o
|
|
||||||
|
|
||||||
INST = $(addprefix $(DESTDIR)$(LIBDIR)/, $(LIBS))
|
|
||||||
|
|
||||||
all: $(LIBS)
|
|
||||||
|
|
||||||
%.o: %.asm
|
|
||||||
$(AS) $< $@
|
|
||||||
|
|
||||||
$(DESTDIR)$(LIBDIR)/%.o: %.o
|
|
||||||
install -D $< $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) $(LIBS)
|
|
||||||
|
|
||||||
install: $(INST)
|
|
||||||
|
|
||||||
include stpd.base.mk
|
include stpd.base.mk
|
||||||
|
|
||||||
|
all: crt0.o
|
||||||
|
|
||||||
|
install: $(DESTDIR)$(LIBDIR)/crt0.o
|
||||||
|
|
||||||
|
$(DESTDIR)$(LIBDIR)/crt0.o: crt0.o
|
||||||
|
$(MSG_INSTALL)
|
||||||
|
@install -D $< $@
|
||||||
|
|
||||||
|
CLEANFILES = crt0.o
|
||||||
|
|
||||||
|
include stpd.clean.mk
|
||||||
|
|
|
@ -1,30 +1,7 @@
|
||||||
LIBS = liblzp.a
|
LIB = lzp
|
||||||
OBJS = lzp.o
|
OBJS= lzp.o
|
||||||
|
|
||||||
INCS = lzp.h
|
INCS = lzp.h
|
||||||
ASMINCS = lzp.inc
|
ASMINCS = lzp.inc
|
||||||
|
|
||||||
INST = $(addprefix $(DESTDIR)$(INCDIR)/, $(INCS)) \
|
include stpd.lib.mk
|
||||||
$(addprefix $(DESTDIR)$(ASMDIR)/, $(ASMINCS)) \
|
|
||||||
$(addprefix $(DESTDIR)$(LIBDIR)/, $(LIBS))
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: $(LIBS)
|
|
||||||
|
|
||||||
$(LIBS): $(OBJS)
|
|
||||||
$(AR) rcs $@ $^
|
|
||||||
|
|
||||||
%.o: %.asm
|
|
||||||
$(AS) $< $@
|
|
||||||
|
|
||||||
$(DESTDIR)$(LIBDIR)/%.a: %.a
|
|
||||||
install -D $< $@
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
$(RM) $(LIBS) $(OBJS)
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: $(INST)
|
|
||||||
|
|
||||||
include stpd.inc.mk
|
|
||||||
|
|
26
share/mk/stpd.lib.mk
Normal file
26
share/mk/stpd.lib.mk
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
include stpd.base.mk
|
||||||
|
|
||||||
|
ifdef LIB
|
||||||
|
|
||||||
|
_LIB:=lib$(LIB).a
|
||||||
|
_LIBINST=$(addprefix $(DESTDIR)$(LIBDIR)/, $(_LIB))
|
||||||
|
|
||||||
|
all: $(_LIB)
|
||||||
|
|
||||||
|
$(_LIB): $(OBJS)
|
||||||
|
$(MSG_BUILD)
|
||||||
|
@$(AR) rcs $@ $^
|
||||||
|
|
||||||
|
install: $(_LIBINST)
|
||||||
|
|
||||||
|
$(_LIBINST): $(_LIB)
|
||||||
|
$(MSG_INSTALL)
|
||||||
|
@install -D $< $@
|
||||||
|
|
||||||
|
CLEANFILES += $(_LIB) $(OBJS)
|
||||||
|
|
||||||
|
include stpd.inc.mk
|
||||||
|
include stpd.man.mk
|
||||||
|
include stpd.clean.mk
|
||||||
|
|
||||||
|
endif
|
|
@ -2,7 +2,23 @@ include stpd.base.mk
|
||||||
|
|
||||||
ifdef MAN
|
ifdef MAN
|
||||||
|
|
||||||
|
define maninstall-rule
|
||||||
|
|
||||||
|
$1/$2: $2
|
||||||
|
$$(MSG_INSTALL)
|
||||||
|
@install -D $2 $1/$2
|
||||||
|
|
||||||
|
endef
|
||||||
|
|
||||||
_MSECTIONS= 1 2 3 4 5 6 7 8 9
|
_MSECTIONS= 1 2 3 4 5 6 7 8 9
|
||||||
_MANINST=$(foreach S,$(_MSECTIONS),$(addprefix $(DESTDIR)$(MANDIR)/$S/,$(filter %.$S,$(MAN))))
|
_MANINST=$(foreach S,$(_MSECTIONS),$(addprefix $(DESTDIR)$(MANDIR)/$S/,$(filter %.$S,$(MAN))))
|
||||||
|
|
||||||
|
maninstall: $(_MANINST)
|
||||||
|
|
||||||
|
$(eval $(foreach S,$(_MSECTIONS), \
|
||||||
|
$(foreach M,$(filter %.$S,$(MAN)), \
|
||||||
|
$(call maninstall-rule,$(DESTDIR)$(MANDIR)/$S,$M))))
|
||||||
|
|
||||||
|
install: maninstall
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue