2009-04-04 20:24:21 +02:00
|
|
|
obj ?= $(shell pwd)
|
|
|
|
|
2014-01-28 00:17:29 +01:00
|
|
|
HOSTCC ?= $(CC)
|
2013-12-03 20:13:35 +01:00
|
|
|
CFLAGS ?= -g
|
|
|
|
CFLAGS += -D_7ZIP_ST
|
|
|
|
CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
|
|
|
|
CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
|
|
|
|
CFLAGS += -Wstrict-aliasing -Werror
|
|
|
|
# You're going to have to fix the LzmaEnc.c first -- it's horrible.
|
|
|
|
# CFLAGS += -Wshadow
|
|
|
|
LDFLAGS += -g
|
2009-09-14 15:29:27 +02:00
|
|
|
|
|
|
|
BINARY:=$(obj)/cbfstool
|
2009-05-26 14:22:10 +02:00
|
|
|
|
2012-12-15 00:16:21 +01:00
|
|
|
COMMON:=cbfstool.o common.o cbfs_image.o compress.o fit.o
|
2013-12-30 22:16:18 +01:00
|
|
|
COMMON+=elfheaders.o cbfs-mkstage.o cbfs-mkpayload.o xdr.o
|
2012-10-30 22:02:45 +01:00
|
|
|
# LZMA
|
|
|
|
COMMON+=lzma/lzma.o
|
|
|
|
COMMON+=lzma/C/LzFind.o lzma/C/LzmaDec.o lzma/C/LzmaEnc.o
|
2009-04-04 20:24:21 +02:00
|
|
|
|
2013-08-27 20:22:21 +02:00
|
|
|
COMMON+=linux_trampoline.o cbfs-payload-linux.o
|
|
|
|
|
2009-09-14 15:29:27 +02:00
|
|
|
COMMON:=$(addprefix $(obj)/,$(COMMON))
|
2009-03-31 13:57:36 +02:00
|
|
|
|
2012-08-16 01:02:52 +02:00
|
|
|
all: dep $(BINARY)
|
|
|
|
|
2009-09-14 15:29:27 +02:00
|
|
|
$(obj)/%.o: %.c
|
|
|
|
$(HOSTCC) $(CFLAGS) -c -o $@ $<
|
2009-03-31 13:57:36 +02:00
|
|
|
|
2009-09-14 15:29:27 +02:00
|
|
|
clean:
|
|
|
|
rm -f $(COMMON) $(BINARY)
|
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
|
|
|
|
2009-09-14 15:29:27 +02:00
|
|
|
$(obj)/cbfstool:$(COMMON)
|
2013-03-29 00:51:45 +01:00
|
|
|
$(HOSTCC) $(CFLAGS) -o $@ $^
|
2012-08-16 01:02:52 +02:00
|
|
|
|
|
|
|
dep:
|
|
|
|
@$(HOSTCC) $(CFLAGS) -MM *.c > .dependencies
|
2013-03-29 00:51:45 +01:00
|
|
|
@$(HOSTCC) $(CFLAGS) -MM lzma/*.c >> .dependencies
|
2012-10-30 22:02:45 +01:00
|
|
|
@$(HOSTCC) $(CFLAGS) -MM lzma/C/*.c >> .dependencies
|
2012-08-16 01:02:52 +02:00
|
|
|
|
|
|
|
-include .dependencies
|