2012-04-23 09:18:34 +00:00
|
|
|
|
2012-05-14 07:57:10 +00:00
|
|
|
# compile options
|
2012-04-23 09:18:34 +00:00
|
|
|
CC = gcc
|
|
|
|
CPPFLAGS = -I. $(ccan_includes)
|
|
|
|
CFLAGS = -Wall -Werror -Wextra -ggdb --std=c99
|
|
|
|
LDFLAGS = -fwhole-program
|
|
|
|
|
2012-05-14 07:57:10 +00:00
|
|
|
# build configuration
|
2012-05-12 16:45:22 +00:00
|
|
|
sbsign_objs = sbsign.o idc.o image.o
|
2012-05-13 04:21:20 +00:00
|
|
|
sbverify_objs = sbverify.o idc.o image.o
|
2012-04-23 09:18:34 +00:00
|
|
|
ccan_objs = lib/ccan/libccan.a
|
|
|
|
ccan_includes = -I./lib/ccan
|
2012-05-14 07:57:10 +00:00
|
|
|
libs = -lbfd -lcrypto
|
2012-04-23 09:18:34 +00:00
|
|
|
|
2012-05-14 08:06:01 +00:00
|
|
|
# install paths
|
|
|
|
DESTDIR ?=
|
|
|
|
prefix ?= /usr
|
|
|
|
bindir ?= ${prefix}/bin
|
|
|
|
install_dirs = install -m 755 -d $(DESTDIR)$(bindir)
|
|
|
|
install_bin = install -m 755 -t $(DESTDIR)$(bindir)
|
|
|
|
|
2012-05-12 16:48:51 +00:00
|
|
|
tools = sbsign sbverify
|
|
|
|
|
|
|
|
all: $(tools)
|
2012-04-23 09:18:34 +00:00
|
|
|
|
2012-05-12 16:45:22 +00:00
|
|
|
sbsign: $(sbsign_objs) $(ccan_objs)
|
2012-04-23 09:18:34 +00:00
|
|
|
$(LINK.o) -o $@ $^ $(libs)
|
|
|
|
|
|
|
|
sbverify: $(sbverify_objs) $(ccan_objs)
|
|
|
|
$(LINK.o) -o $@ $^ $(libs)
|
|
|
|
|
|
|
|
gen-keyfiles: gen-keyfiles.o $(ccan_objs)
|
|
|
|
$(LINK.o) -o $@ $^ $(libs)
|
|
|
|
gen-keyfiles: libs = -luuid
|
|
|
|
|
|
|
|
$(ccan_objs):
|
|
|
|
cd $(@D) && $(MAKE)
|
|
|
|
|
2012-05-14 08:06:01 +00:00
|
|
|
install: $(tools)
|
|
|
|
$(install_dirs)
|
|
|
|
$(install_bin) $(tools)
|
|
|
|
.PHONY: install
|
|
|
|
|
2012-04-23 09:18:34 +00:00
|
|
|
clean:
|
2012-05-12 16:48:51 +00:00
|
|
|
rm -f $(tools)
|
2012-04-23 09:18:34 +00:00
|
|
|
rm -f *.o
|