2015-03-06 00:38:03 +01:00
|
|
|
obj ?= .
|
2009-04-04 20:24:21 +02:00
|
|
|
|
2014-01-28 00:17:29 +01:00
|
|
|
HOSTCC ?= $(CC)
|
2009-09-14 15:29:27 +02:00
|
|
|
|
2015-04-26 21:41:41 +02:00
|
|
|
CFLAGS += -g3
|
2015-03-06 00:38:03 +01:00
|
|
|
CFLAGS += -std=c99 -Werror -Wall -Wextra
|
|
|
|
CFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow
|
|
|
|
CFLAGS += -Wstrict-prototypes -Wwrite-strings
|
|
|
|
CPPFLAGS += -D_POSIX_C_SOURCE=200809L # strdup() from string.h
|
2015-05-03 09:35:32 +02:00
|
|
|
LDFLAGS += -g3
|
2009-05-26 14:22:10 +02:00
|
|
|
|
2015-03-06 00:38:03 +01:00
|
|
|
CBFSTOOL_BINARY:=$(obj)/cbfstool
|
|
|
|
CBFSTOOL_COMMON:=common.o cbfs_image.o compress.o fit.o
|
2014-03-07 22:11:53 +01:00
|
|
|
CBFSTOOL_COMMON+=elfheaders.o cbfs-mkstage.o cbfs-mkpayload.o xdr.o
|
2015-03-06 00:38:03 +01:00
|
|
|
CBFSTOOL_COMMON+=linux_trampoline.o cbfs-payload-linux.o
|
2012-10-30 22:02:45 +01:00
|
|
|
# LZMA
|
2014-03-07 22:11:53 +01:00
|
|
|
CBFSTOOL_COMMON+=lzma/lzma.o
|
|
|
|
CBFSTOOL_COMMON+=lzma/C/LzFind.o lzma/C/LzmaDec.o lzma/C/LzmaEnc.o
|
2009-04-04 20:24:21 +02:00
|
|
|
|
2014-03-07 22:11:53 +01:00
|
|
|
CBFSTOOL_COMMON:=$(addprefix $(obj)/,$(CBFSTOOL_COMMON))
|
2009-03-31 13:57:36 +02:00
|
|
|
|
2014-03-07 22:11:53 +01:00
|
|
|
|
|
|
|
RMODTOOL_BINARY:=$(obj)/rmodtool
|
2015-03-06 00:38:03 +01:00
|
|
|
RMODTOOL_COMMON:=rmodule.o common.o elfheaders.o xdr.o
|
2014-03-07 22:11:53 +01:00
|
|
|
|
|
|
|
RMODTOOL_COMMON:=$(addprefix $(obj)/,$(RMODTOOL_COMMON))
|
|
|
|
|
2015-03-06 00:38:03 +01:00
|
|
|
.PHONY: all
|
|
|
|
all: .dependencies $(CBFSTOOL_BINARY) $(RMODTOOL_BINARY)
|
2012-08-16 01:02:52 +02:00
|
|
|
|
2015-03-06 00:38:03 +01:00
|
|
|
$(obj)/%: $(obj)/%.o
|
|
|
|
mkdir -p $(dir $@)
|
2015-05-03 09:35:32 +02:00
|
|
|
$(HOSTCC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
2009-09-14 15:29:27 +02:00
|
|
|
$(obj)/%.o: %.c
|
2015-03-06 00:38:03 +01:00
|
|
|
mkdir -p $(dir $@)
|
|
|
|
$(HOSTCC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
2009-03-31 13:57:36 +02:00
|
|
|
|
2015-03-06 00:38:03 +01:00
|
|
|
.PHONY: clean
|
2009-09-14 15:29:27 +02:00
|
|
|
clean:
|
2015-03-06 00:38:03 +01:00
|
|
|
$(RM) $(CBFSTOOL_COMMON) $(CBFSTOOL_BINARY).o $(CBFSTOOL_BINARY)
|
|
|
|
$(RM) $(RMODTOOL_COMMON) $(RMODTOOL_BINARY).o $(RMODTOOL_BINARY)
|
|
|
|
.PHONY: distclean
|
|
|
|
distclean: clean
|
|
|
|
$(RM) .dependencies
|
2009-03-31 13:57:36 +02:00
|
|
|
|
2010-04-27 08:56:47 +02:00
|
|
|
tags:
|
2009-09-14 15:29:27 +02:00
|
|
|
ctags *.[ch]
|
2009-04-04 20:24:21 +02:00
|
|
|
|
2015-03-06 00:38:03 +01:00
|
|
|
.dependencies:
|
|
|
|
@$(HOSTCC) $(CPPFLAGS) $(CFLAGS) -MM -MG *.c > $@
|
|
|
|
@$(HOSTCC) $(CPPFLAGS) $(CFLAGS) -MM lzma/*.c >> $@
|
|
|
|
@$(HOSTCC) $(CPPFLAGS) $(CFLAGS) -MM lzma/C/*.c >> $@
|
|
|
|
@sed -i 's|.*:.*|$$(obj)/&|' $@
|
2014-03-07 22:11:53 +01:00
|
|
|
|
2015-03-06 00:38:03 +01:00
|
|
|
$(CBFSTOOL_BINARY): $(CBFSTOOL_COMMON)
|
|
|
|
$(RMODTOOL_BINARY): $(RMODTOOL_COMMON)
|
2012-08-16 01:02:52 +02:00
|
|
|
|
2015-03-06 00:38:03 +01:00
|
|
|
# Tolerate lzma sdk warnings
|
|
|
|
$(obj)/lzma/C/LzmaEnc.o: CFLAGS += -Wno-sign-compare -Wno-cast-qual
|
2012-08-16 01:02:52 +02:00
|
|
|
|
|
|
|
-include .dependencies
|