This fixes a race condition (revealed by my other check-in r4067) in the
romtool by changing the Makefiles to be no longer recursive (once again, recursive make is to be considered harmful). Tried to (quickly) unify most of the Makefile code, but medium-term this is going to be worked on for Kconfig support anyways. Also fix a sign cast error in rom-mkpayload in case people want to compile this with -W -Werror Patch relative to coreboot-v2/util/romtool Signed-off-by: Stefan Reinauer <stepan@coresystems.de> and Acked-by: Stefan Reinauer <stepan@coresystems.de> in order to get the tree working decently asap git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4069 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
16e34b98a1
commit
14ad50edf6
|
@ -6,11 +6,11 @@ obj ?= $(shell pwd)
|
|||
|
||||
COMMANDS=create.o bootblock.o delete.o add.o print.o resize.o
|
||||
OBJ=$(COMMANDS) romtool.o util.o fs.o
|
||||
INC=romtool.h romfs.h
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-g -Wall -W #-Werror
|
||||
CFLAGS=-g -Wall # -W -Werror
|
||||
|
||||
H=romtool.h
|
||||
DESTDIR ?= /usr/local/bin
|
||||
|
||||
all: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
||||
|
@ -18,10 +18,12 @@ all: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
|||
$(obj)/romtool: $(patsubst %,$(obj)/%,$(OBJ))
|
||||
$(CC) -o $@ $(patsubst %,$(obj)/%,$(OBJ))
|
||||
|
||||
$(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage:
|
||||
$(MAKE) -C tools/ obj=$(obj)/tools $(patsubst tools/%, %, $@)
|
||||
tobj = $(obj)/tools
|
||||
tsrc = $(shell pwd)/tools
|
||||
|
||||
$(obj)/%.o: %.c
|
||||
include tools/Makefile
|
||||
|
||||
$(obj)/%.o: %.c $(INC)
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
install: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
||||
|
@ -33,6 +35,6 @@ install: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
|||
tags:
|
||||
ctags *.[ch] */*.[ch]
|
||||
|
||||
clean:
|
||||
$(MAKE) -C tools/ clean
|
||||
clean: tools-clean
|
||||
rm -f $(patsubst %,$(obj)/%,$(OBJ)) $(obj)/romtool
|
||||
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
obj ?= $(shell pwd)
|
||||
tobj ?= $(shell pwd)
|
||||
tsrc ?= $(shell pwd)
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -W -Werror -g
|
||||
TARGETS += $(tobj)/rom-mkstage $(tobj)/rom-mkpayload
|
||||
|
||||
all: rom-mkstage rom-mkpayload
|
||||
tools: $(tobj)/rom-mkstage $(tobj)/rom-mkpayload
|
||||
|
||||
include lzma/Makefile
|
||||
include $(tobj)/lzma/Makefile
|
||||
|
||||
COMMON = common.o compress.o $(LZMA_OBJ)
|
||||
|
||||
$(tobj)/rom-mkstage: $(tobj)/rom-mkstage.o $(patsubst %,$(tobj)/%,$(COMMON))
|
||||
$(CXX) $(CFLAGS) -o $@ $^
|
||||
|
||||
$(obj)/rom-mkstage: $(obj)/rom-mkstage.o $(patsubst %,$(obj)/%,$(COMMON))
|
||||
$(CXX) -g -o $@ $(obj)/rom-mkstage.o $(patsubst %,$(obj)/%,$(COMMON))
|
||||
$(tobj)/rom-mkpayload: $(tobj)/rom-mkpayload.o $(patsubst %,$(tobj)/%,$(COMMON))
|
||||
$(CXX) $(CFLAGS) -o $@ $^
|
||||
|
||||
$(obj)/rom-mkpayload: $(obj)/rom-mkpayload.o $(patsubst %,$(obj)/%,$(COMMON))
|
||||
$(CXX) -o $@ $(obj)/rom-mkpayload.o $(patsubst %,$(obj)/%,$(COMMON))
|
||||
$(tobj)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(obj)/%.o: %.c
|
||||
$(CC) -Wall -Werror -g -c -o $@ $<
|
||||
|
||||
clean:
|
||||
@ rm -f rom-mkpayload.o rom-mkstage.o $(COMMON)
|
||||
@ rm -f rom-mkpayload rom-mkstage
|
||||
tools-clean:
|
||||
rm -f $(tobj)/rom-mkpayload.o $(tobj)/rom-mkstage.o $(patsubst %,$(tobj)/%,$(COMMON))
|
||||
rm -f $(tobj)/rom-mkpayload $(tobj)/rom-mkstage
|
||||
|
||||
|
|
|
@ -24,27 +24,27 @@ LZMA_OBJ += lzma/OutBuffer.o lzma/Alloc.o
|
|||
LZMA_OBJ += lzma/CRC.o
|
||||
LZMA_OBJ += lzma/lzma-compress.o
|
||||
|
||||
$(obj)/lzma/lzma-compress.o: lzma/minilzma.cc
|
||||
g++ -o $@ -c -DCOMPACT $<
|
||||
$(tobj)/lzma/lzma-compress.o: $(tsrc)/lzma/minilzma.cc
|
||||
$(CXX) $(CFLAGS) -o $@ -c -DCOMPACT $<
|
||||
|
||||
$(obj)/lzma/%.o: lzma/C/7zip/Compress/LZMA/%.cpp
|
||||
g++ -o $@ -c $<
|
||||
$(tobj)/lzma/%.o: $(tsrc)/lzma/C/7zip/Compress/LZMA/%.cpp
|
||||
$(CXX) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(obj)/lzma/%.o: lzma/C/7zip/Compress/LZ/%.cpp
|
||||
g++ -o $@ -c $<
|
||||
$(tobj)/lzma/%.o: $(tsrc)/lzma/C/7zip/Compress/LZ/%.cpp
|
||||
$(CXX) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(obj)/lzma/%.o: lzma/C/7zip/Compress/RangeCoder/%.cpp
|
||||
g++ -o $@ -c $<
|
||||
$(tobj)/lzma/%.o: $(tsrc)/lzma/C/7zip/Compress/RangeCoder/%.cpp
|
||||
$(CXX) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(obj)/lzma/%.o: lzma/C/7zip/Decompress/%.cpp
|
||||
g++ -o $@ -c $<
|
||||
$(tobj)/lzma/%.o: $(tsrc)/lzma/C/7zip/Decompress/%.cpp
|
||||
$(CXX) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(obj)/lzma/%.o: lzma/C/7zip/Common/%.cpp
|
||||
g++ -o $@ -c $<
|
||||
$(tobj)/lzma/%.o: $(tsrc)/lzma/C/7zip/Common/%.cpp
|
||||
$(CXX) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(obj)/lzma/%.o: lzma/C/Common/%.cpp
|
||||
g++ -o $@ -c $<
|
||||
$(tobj)/lzma/%.o: $(tsrc)/lzma/C/Common/%.cpp
|
||||
$(CXX) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(obj)/lzma/%.o: lzma/%.cc
|
||||
g++ -o $@ -c $<
|
||||
$(tobj)/lzma/%.o: $(tsrc)/lzma/%.cc
|
||||
$(CXX) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ int parse_elf(unsigned char *input, unsigned char **output, int algo,
|
|||
/* If the compressed section is larger, then use the
|
||||
original stuff */
|
||||
|
||||
if (len > phdr[i].p_filesz) {
|
||||
if ((unsigned int)len > phdr[i].p_filesz) {
|
||||
segs[segments].compression = 0;
|
||||
segs[segments].len = htonl(phdr[i].p_filesz);
|
||||
|
||||
|
|
Loading…
Reference in New Issue