1#
2# LGPL/GPL code library
3#
4
5# Include configuration rules
6include $(MAKEDIR)/lib.mk
7
8REQFLAGS += -I$(SRC)/../gplinclude -I$(SRC)/../gplinclude/zzjson
9
10GPLDIRS := $(SRC) $(addprefix $(SRC)/,disk dmi vpd acpi zzjson)
11LIBOBJS := $(subst $(SRC)/,,$(foreach dir,$(GPLDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c))))
12
13BINDIR   = /usr/bin
14LIBDIR   = /usr/lib
15DATADIR  = /usr/share
16AUXDIR   = $(DATADIR)/syslinux
17INCDIR   = /usr/include
18COM32DIR = $(AUXDIR)/com32
19
20all: makeoutputdirs libgpl.c32
21
22makeoutputdirs:
23	@mkdir -p $(foreach b, \
24		$(addprefix $(OBJ),$(sort $(dir $(LIBOBJS)))),$(b))
25
26libgpl.elf : $(LIBOBJS)
27	$(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^
28
29tidy dist clean:
30	find . \( -name \*.o -o -name .\*.d -o -name \*.tmp \) -print0 | \
31		xargs -0r rm -f
32
33spotless: clean
34	rm -f *.c32
35	rm -f *~ \#* */*~ */\#*
36
37# Mixing in the GPL include files is suboptimal, but I'm not sure
38# there is a better way to do it.
39install: all
40	mkdir -m 755 -p $(INSTALLROOT)$(COM32DIR)
41	install -m 644 libgpl.c32 $(INSTALLROOT)$(COM32DIR)
42	mkdir -p $(INSTALLROOT)$(COM32DIR)/include/
43	cp -r $(SRC)/../gplinclude $(INSTALLROOT)$(COM32DIR)/include/
44
45-include .*.d */.*.d */*/.*.d
46