--- a/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -26,10 +26,15 @@
include $(EPOCROOT)/build/makefiles-garage/global-make-env.mk
endif
+ifeq '$(file)' ''
+file = diffs.patch
+endif
+
garage = $(EPOCROOT)/build/makefiles-garage
garage_makefiles = $(shell find $(garage) -name Makefile)
targets = $(notdir $(patsubst %/Makefile,%,$(garage_makefiles)))
clean_targets = $(addsuffix -clean,$(targets))
+what_targets = $(addsuffix -what,$(targets))
garage_make_dirs = $(patsubst %/Makefile,%,$(garage_makefiles))
make_dirs = $(patsubst $(garage)%,$(EPOCROOT)/build%,$(garage_make_dirs))
makefiles = $(patsubst $(garage)/%,$(EPOCROOT)/build/%,$(garage_makefiles))
@@ -38,7 +43,8 @@
subdirs = imgtools e32tools sbsv2 srctools buildframework buildtoolguides bintools
.PHONY: all tools export gen_preinclude clean distclean deploy_makefiles gather_makefiles help \
-sbs_comp_list sbs_targ_list list_hacks list_prereqs
+sbs_comp_list sbs_targ_list list_fixups list_prereqs
+
all: tools
@@ -64,21 +70,25 @@
@echo " clean - Remove all build object files, libraries and executables"
@echo " TARGET-clean - clean the real target TARGET"
@echo " distclean - Remove everything but the original files"
- @echo " deploy_makefiles - Copy makefiles from the garage to the locations where they run"
- @echo " gather_makefiles - Gather any new or updated makefiles from the places where they run into the garage"
+ @echo " deploy_makefiles - Copy makefiles from the 'makefiles_garage' to the locations where they run"
+ @echo " gather_makefiles - Gather any new or updated makefiles from the places where they run into the 'makefiles_garage'"
@echo " export - TODO: No exports are implemented yet"
- @echo " what - TODO: \"What is built?\" not implemented yet"
- @echo " TARGET-what - TODO: \"What is built for TARGET?\" not implemented yet"
+ @echo " what - List the files built by the real targets."
+ @echo " missing - List the real targets that do not exist."
+ @echo " TARGET-what - List the files built by the real target TARGET."
@echo " sbs_comp_list - List the components that sbs would find (BLD.INF files)"
@echo " sbs_targ_list - List the targets that sbs would find (MMP files)"
@echo " list_prereqs - List the dependency graph of final targets"
- @echo " list_hacks - List the targets and files for which hacks are currently applied."
- @echo " The hacks are applied by the make and removed by clean."
+ @echo " list_fixes - List the targets and files for which fixes are currently applied."
+ @echo " The fixes are applied by the make and removed by clean."
+ @echo " fix - Just apply the fixes. Don't build."
+ @echo " diff [file=FILE] - List the diffs that are generated by applying the fixups."
+ @echo " The diffs are written to FILE, if specified, else to ./diffs.patch."
@echo ""
@echo "Real targets in hierarchy:"
@echo ""
@for file in $(sort $(garage_makefiles)); do \
- dummy=`grep 'include $$(EPOCROOT)/build/makefiles-garage/todo.mk' $$file 2> /dev/null`;\
+ dummy=`grep '^include $$(EPOCROOT)/build/makefiles-garage/todo.mk' $$file 2> /dev/null`;\
todo=;\
file=$${file#$(garage)/};\
file=$${file%/Makefile};\
@@ -119,16 +129,44 @@
sbs_targ_list:
@for file in `find . -iname '*.mmp'`; do echo $${file}; done
-list_hacks: $(makefiles)
+list_fixes: $(makefiles)
@for make_dir in $(sort $(make_dirs)); do \
- $(MAKE) -s -C $$make_dir query=1 targ=$${make_dir##*/} hacks; \
+ $(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _list_fixes; \
done
list_prereqs: $(makefiles)
@for make_dir in $(sort $(make_dirs)); do \
- $(MAKE) -s -C $$make_dir query=1 targ=$${make_dir##*/} prereqs; \
+ $(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _list_prereqs; \
+ done
+
+fix: $(makefiles)
+ @for make_dir in $(sort $(make_dirs)); do \
+ $(MAKE) -C $$make_dir call_in=1 fixes; \
+ done
+
+what: $(makefiles)
+ @for make_dir in $(sort $(make_dirs)); do \
+ $(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _what; \
done
+missing: $(makefiles)
+ @for make_dir in $(sort $(make_dirs)); do \
+ $(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _missing; \
+ done
+
+diff:
+ $(MAKE) distclean && \
+ rm -fr ../pristine && \
+ mkdir ../pristine && \
+ cp -r -t ../pristine * && \
+ $(MAKE) fix && \
+ diff -r -b ../pristine ../build > $(file)
+ for file in `find bintools/rcomp -name '*.CPP.original' -or -name '*.H.original' -or -name '*.LEX.original' -or -name '*.YACC.original'`; do \
+ lcfile=$$(file%\.original) && \
+ lcfile=`echo $$lcile | tr '[:upper:]' '[:lower:]'` && \
+ diff -r -b $$file $$lcfile >> $(file); \
+ done
+
$(targets): $(preinclude) $(makefiles)
garage_makedir=`find $(garage) -name $@`;\
makedir=$${garage_makedir##$(garage)/};\
@@ -139,8 +177,20 @@
targ=$@; \
targ=$${targ%-clean}; \
garage_makedir=`find $(garage) -name $${targ}`;\
- echo $$targ; \
- makedir=$${garage_makedir##$(garage)/};\
- makedir=$(EPOCROOT)/build/$${makedir};\
- $(MAKE) -C $${makedir} clean
+ if [ "$$garage_makedir" != "" ]; then \
+ makedir=$${garage_makedir##$(garage)/};\
+ makedir=$(EPOCROOT)/build/$${makedir};\
+ $(MAKE) -C $${makedir} clean; \
+ fi
+
+$(what_targets): $(makefiles)
+ @targ=$@; \
+ targ=$${targ%-what}; \
+ garage_makedir=`find $(garage) -name $${targ}`;\
+ if [ "$$garage_makedir" != "" ]; then \
+ makedir=$${garage_makedir##$(garage)/};\
+ makedir=$(EPOCROOT)/build/$${makedir};\
+ $(MAKE) -C $${makedir} call_in=1 targ=$${make_dir##*/} what; \
+ fi
+
--- a/makefiles-garage/bintools/checklib/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/bintools/checklib/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -11,16 +11,56 @@
# Contributors:
#
# Description:
-# This is a Linux makefile for checklib.
-
+# This is a Linux makefile for checklib.
ifdef EPOCROOT
include $(EPOCROOT)/build/makefiles-garage/global-make-env.mk
else
$(error EPOCROOT must be defined as the parent directory of your epoc32 tree)
endif
+
+cpp_inc_paths = -I . -I object/coff -I ..
+
+lib_opts =
+
+exe = checklib
+
+CPPFLAGS = $(cpp_inc_paths) $(global_cpp_flags)
+LDFLAGS = $(lib_opts) $(global_ld_flags)
+
+prereqs =
+
+srcs = main.cpp \
+library/library.cpp \
+misc/endian.cpp \
+object/object.cpp \
+object/elf_object.cpp \
+object/coff_object.cpp \
+object/elf/elf_file_header.cpp \
+object/elf/elf_section_header.cpp \
+object/elf/elf_symbol.cpp \
+object/elf/elf_string_table.cpp \
+object/coff/coff_file_header.cpp \
+object/coff/coff_symbol.cpp \
+object/coff/coff_string_table.cpp
-todo_target = checklib
-include $(EPOCROOT)/build/makefiles-garage/todo.mk
-all: todo
+
+.PHONY: all clean $(prereqs)
+
+all: $(exe)
+
+bases = $(basename $(srcs))
+
+objs = $(addsuffix .o,$(bases))
+$(prereqs): $(global_prereqs)
+ $(MAKE) -C $(EPOCROOT)/build $@
+
+$(objs): $(prereqs)
+
+$(exe): $(objs)
+ $(CC) -o $@ $(objs) $(LDFLAGS)
+
+clean:
+ rm -f $(objs) $(exe)
+
--- a/makefiles-garage/bintools/elftools/elfdump/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/bintools/elftools/elfdump/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -40,10 +40,12 @@
objs = $(addsuffix .o,$(bases))
+$(objs): $(prereqs)
+
$(prereqs): $(global_prereqs)
$(MAKE) -C $(EPOCROOT)/build $@
-$(exe): $(objs) $(prereqs)
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
clean:
--- a/makefiles-garage/bintools/elftools/elftran/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/bintools/elftools/elftran/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -66,17 +66,19 @@
$(prereqs): $(global_prereqs)
$(MAKE) -C $(EPOCROOT)/build $@
+
+$(objs): $(prereqs)
-$(exe): $(objs) $(prereqs)
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
clean: remove_fixes
rm -f $(objs) $(exe)
-fixes: $(fixbackups)
+fixes:: $(fixbackups)
remove_fixes:
- for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%original}; fi; done
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
../inc/e32ldfmt.h.original:
cp $(basename $@) $@ && \
--- a/makefiles-garage/bintools/elftools/genstubs/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/bintools/elftools/genstubs/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -42,8 +42,10 @@
$(prereqs): $(global_prereqs)
$(MAKE) -C $(EPOCROOT)/build $@
+
+$(objs): $(prereqs)
-$(exe): $(objs) $(prereqs)
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
clean:
--- a/makefiles-garage/bintools/elftools/getexports/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/bintools/elftools/getexports/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -48,17 +48,19 @@
$(prereqs): $(global_prereqs)
$(MAKE) -C $(EPOCROOT)/build $@
-
-$(exe): $(objs) $(prereqs)
+
+$(objs): $(prereqs)
+
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
clean: remove_fixes
rm -f $(objs) $(exe)
-fixes: $(fixbackups)
+fixes:: $(fixbackups)
remove_fixes:
- for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%original}; fi; done
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
geninf.cpp.original:
cp $(basename $@) $@ && \
--- a/makefiles-garage/bintools/rcomp/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/bintools/rcomp/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -13,14 +13,112 @@
# Description:
# This is a Linux makefile for rcomp.
+# Need to make symklinks rcomp.l -> RCOMP.LEX, rcomp.y -> RCOMP.YACC
ifdef EPOCROOT
include $(EPOCROOT)/build/makefiles-garage/global-make-env.mk
else
$(error EPOCROOT must be defined as the parent directory of your epoc32 tree)
endif
-
-todo_target = rcomp
-include $(EPOCROOT)/build/makefiles-garage/todo.mk
-all: todo
+
+cpp_inc_paths = -I inc -I src
+
+lib_opts =
+
+exe = rcomp
+
+CPPFLAGS = $(cpp_inc_paths) $(global_cpp_flags)
+LDFLAGS = $(lib_opts) $(global_ld_flags)
+
+prereqs =
+
+ucase_lexyaccfiles = src/RCOMP.LEX src/RCOMP.YACC
+lcase_lexyaccfiles = $(shell echo $(ucase_lexyaccfiles) | tr '[:upper:]' '[:lower:]')
+
+ucase_srcfiles = \
+src/ARRAY.CPP \
+src/ASTRING.CPP \
+src/CCODES.CPP \
+src/CTABLE.CPP \
+src/DATATYPE.CPP \
+src/ERRORHAN.CPP \
+src/FILEACC.CPP \
+src/FILELINE.CPP \
+src/INDEXTAB.CPP \
+src/LINKLIST.CPP \
+src/MEM.CPP \
+src/NAMEIDMA.CPP \
+src/NUMVAL.CPP \
+src/RCBINSTR.CPP \
+src/RCOSTRM.CPP \
+src/RCSCAN.CPP \
+src/RCSTACK.CPP \
+src/RESOURCE.CPP \
+src/STACK.CPP \
+src/STRINGAR.CPP \
+src/STRUCTST.CPP \
+src/UNICODE_COMPRESSOR.CPP \
+src/QUALIFAR.CPP
+
+lcase_srcfiles = $(shell echo $(ucase_srcfiles) | tr '[:upper:]' '[:lower:]')
+
+srcs = src/main.cpp \
+src/localise.cpp \
+src/messages.cpp \
+src/rcompl.cpp \
+src/rcomp.cpp $(lcase_srcfiles)
+ifneq "$(wildcard inc/*.H.original)" ""
+ucase_headers := $(basename $(wildcard inc/*.H.original))
+else
+ucase_headers := $(wildcard inc/*.H)
+endif
+
+lcase_headers = $(shell echo $(ucase_headers) | tr '[:upper:]' '[:lower:]')
+
+fixfiles = $(ucase_srcfiles) $(ucase_lexyaccfiles) $(ucase_headers) inc/Parser.h
+fixedfiles = $(lcase_srcfiles) $(lcase_lexyaccfiles) $(lcase_headers) inc/parser.h
+fixbackups = $(addsuffix .original,$(fixfiles))
+
+.PHONY: all clean $(prereqs) fixes remove_fixes
+
+all: $(exe)
+
+$(srcs): fixes
+
+bases = $(basename $(srcs))
+
+objs = $(addsuffix .o,$(bases))
+
+$(prereqs): $(global_prereqs)
+ $(MAKE) -C $(EPOCROOT)/build $@
+
+$(objs): $(prereqs)
+
+$(exe): $(objs)
+ $(CC) -o $@ $(objs) $(LDFLAGS)
+
+fixes:: $(fixbackups)
+ for uchdr in $(ucase_headers) inc/Parser.h; do \
+ uchdr=$${uchdr##inc/} && \
+ lchdr=`echo $$uchdr | tr '[:upper:]' '[:lower:]'` && \
+ uchdr=$${uchdr/./\\.} && \
+ for file in $(srcs) inc/*.h; do \
+ sed -e "s|$$uchdr|$$lchdr|g" -i $$file; \
+ done; \
+ done && \
+ sed -e 's|^typedef bool TBool;||g' -i inc/unicode_compressor.h
+
+$(fixbackups):
+ ucfile=$(basename $@) && \
+ cp $$ucfile $@ && \
+ lcfile=`echo $$ucfile | tr '[:upper:]' '[:lower:]'` && \
+ mv $$ucfile $$lcfile
+
+clean: remove_fixes
+ rm -f $(objs) $(exe)
+
+remove_fixes:
+ rm -f $(fixedfiles)
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
+
--- a/makefiles-garage/e32tools/e32lib/seclib/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/e32tools/e32lib/seclib/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -19,9 +19,60 @@
else
$(error EPOCROOT must be defined as the parent directory of your epoc32 tree)
endif
+
+fixfiles = ../setcap/setcap.h
+fixbackups = $(addsuffix .original,$(fixfiles))
-todo_target = seclib
-include $(EPOCROOT)/build/makefiles-garage/todo.mk
-all: todo
+cpp_inc_paths = \
+-I ../../../imgtools/imglib/compress \
+-I ../setcap \
+-I ../../e32lib/e32image/inc
+
+lib = libseclib.a
+
+CPPFLAGS = $(cpp_inc_paths) $(global_cpp_flags)
+CXXFLAGS = $(global_cxx_flags) -pthread
+srcs = \
+seclib.cpp \
+../e32image/e32image.cpp \
+../e32image/deflate/decode.cpp \
+../e32image/deflate/encode.cpp \
+../e32image/deflate/deflate.cpp \
+../e32image/deflate/inflate.cpp \
+../e32image/deflate/panic.cpp \
+../e32image/deflate/compress.cpp \
+../../../imgtools/imglib/compress/pagedcompress.cpp \
+../../../imgtools/imglib/compress/byte_pair.cpp \
+../../../imgtools/imglib/e32uid/e32uid.cpp \
+../setcap/setcap.cpp \
+../../../imgtools/imglib/host/h_file.cpp \
+../../../imgtools/imglib/host/h_mem.cpp \
+../../../imgtools/imglib/host/h_utl.cpp
+
+
+all: $(lib)
+.PHONY: all clean fixes remove_fixes
+
+bases = $(basename $(srcs))
+
+objs = $(addsuffix .o,$(bases))
+
+$(srcs): fixes
+
+$(lib): $(objs)
+ ar r $@ $(objs)
+
+clean: remove_fixes
+ rm -f $(objs) $(lib)
+
+fixes:: $(fixbackups)
+
+../setcap/setcap.h.original:
+ cp $(basename $@) $@ && \
+ sed -e 's|#if !defined(__TOOLS2_LINUX__)|#if !(defined(__TOOLS2__) \&\& defined(__LINUX__))|g' -i $(basename $@)
+
+remove_fixes:
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
+
--- a/makefiles-garage/e32tools/elf2e32/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/e32tools/elf2e32/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -59,7 +59,7 @@
clean: remove_fixes
rm -f $(objs) $(exe)
-fixes: $(fixbackups)
+fixes:: $(fixbackups)
source/pl_elfexecutable.h.original:
cp $(basename $@) $@ && \
@@ -84,5 +84,5 @@
remove_fixes:
- for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%original}; fi; done
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
--- a/makefiles-garage/global-make-env.mk Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/global-make-env.mk Fri Jan 08 16:16:51 2010 +0000
@@ -50,7 +50,7 @@
"#include <climits>\n"\
"#include <exception>\n"\
"#include <new>\n"\
-"#endif\n" >> $@
+"#endif\n" > $@
$(MAKE)
$(linux_gcc_patch_inc_path):
@@ -65,7 +65,7 @@
$(linux_gcc_defs_inc): $(linux_gcc_ver_inc_path)
printf "#ifndef HACK_DEFS_H\n"\
"#define HACK_DEFS_H\n"\
-"#define DIMPORT_C\n"\
+"#define IMPORT_C\n"\
"#define __NO_THROW\n"\
"#define NONSHARABLE_CLASS(x) class x\n"\
"#undef _FOFF\n"\
@@ -74,7 +74,7 @@
"#undef __ASSERT_COMPILE\n"\
"#define __ASSERT_COMPILE(x)\n"\
"#define TAny void\n"\
-"#endif\n" >> $@
+"#endif\n" > $@
endif
# End: make the global preinclude.h file
@@ -82,21 +82,48 @@
endif
# End: included only once
-ifdef query
-# Running one of the query targets
+ifdef call_in
+# Running one of the call_in targets
-hacks:
+_list_fixes:
@if [ "$(fixfiles)" != "" ]; then \
- echo $(targ): hacks for:-; \
+ echo $(targ): fixups for:-; \
for file in $(fixfiles); do echo " $$file"; done; \
fi
-prereqs:
+_list_prereqs:
@if [ "$(prereqs)" != "" ]; then \
echo $(targ): needs:-; \
for prereq in $(prereqs); do echo " $$prereq"; done; \
fi
+
+_what:
+ @if [ "$(exe)" != "" ]; then \
+ targfile=`pwd`/$(exe); \
+ elif [ "$(lib)" != "" ]; then \
+ targfile=`pwd`/$(lib); \
+ fi; \
+ if [ "$$targfile" != "" ]; then \
+ printf "Target $(targ) builds $$targfile"; \
+ if [ ! -f $$targfile ]; then printf " (*** Missing ***)"; fi; \
+ printf "\n"; \
+ fi
+
+_missing:
+ @if [ "$(exe)" != "" ]; then \
+ targfile=`pwd`/$(exe); \
+ elif [ "$(lib)" != "" ]; then \
+ targfile=`pwd`/$(lib); \
+ fi; \
+ if [ "$$targfile" != "" ]; then \
+ if [ ! -f $$targfile ]; then printf "Target $(targ) is missing $$targfile\n"; fi; \
+ fi
+
+
+fixes::
endif
-# End: Running one of the query targets
+# End: Running one of the call_in targets
+
+
--- a/makefiles-garage/imgtools/imgcheck/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/imgtools/imgcheck/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -53,14 +53,16 @@
$(prereqs): $(global_prereqs)
$(MAKE) -C $(EPOCROOT)/build $@
-$(exe): $(objs) $(prereqs)
+$(objs): $(prereqs)
+
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
clean: remove_fixes
rm -f $(objs) $(exe)
for file in $(subdirs); do $(MAKE) -C $$file clean; done
-fixes: $(fixbackups)
+fixes:: $(fixbackups)
inc/exceptionimplementation.h.original:
cp $(basename $@) $@ && \
@@ -81,5 +83,5 @@
-e 's|ofstream xslDestHandle|Ofstream xslDestHandle|g' -i $(basename $@)
remove_fixes:
- for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%original}; fi; done
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
--- a/makefiles-garage/imgtools/imgcheck/libimgutils/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/imgtools/imgcheck/libimgutils/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -81,7 +81,7 @@
clean: remove_fixes
rm -f $(objs) $(lib)
-fixes: $(fixbackups)
+fixes:: $(fixbackups)
inc/typedefs.h.original:
cp $(basename $@) $@ && \
@@ -91,5 +91,5 @@
-e 's|typedef ifstream|typedef std::ifstream|g' -i $(basename $@)
remove_fixes:
- for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%original}; fi; done
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
--- a/makefiles-garage/imgtools/romtools/r_t_areaset/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/imgtools/romtools/r_t_areaset/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -69,11 +69,14 @@
objs = $(addsuffix .o,$(bases))
-$(exe): $(objs) $(prereqs)
+$(prereqs): $(global_prereqs)
+ $(MAKE) -C $(EPOCROOT)/build $@
+
+$(objs): $(prereqs)
+
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
-$(prereqs): $(global_prereqs)
- $(MAKE) -C $(EPOCROOT)/build $@
clean:
rm -f $(objs) $(exe)
--- a/makefiles-garage/imgtools/romtools/readimage/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/imgtools/romtools/readimage/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -20,6 +20,124 @@
$(error EPOCROOT must be defined as the parent directory of your epoc32 tree)
endif
-todo_target = seclib
-include $(EPOCROOT)/build/makefiles-garage/todo.mk
-all: todo
+cpp_inc_paths = \
+-I ../readimage/inc \
+-I ../rofsbuild \
+-I../rombuild \
+-I ../../imglib/compress \
+-I ../../imglib/patchdataprocessor/include \
+-I ../../sisutils/inc \
+-I ../../imglib/inc
+
+lib_opts = -lboost_thread-mt \
+-L../../sisutils -lsisutils \
+
+exe = readimage
+
+CPPFLAGS = $(cpp_inc_paths) $(global_cpp_flags) -D__SUPPORT_ELF_FILES__
+CXXFLAGS = $(global_cxx_flags) -pthread
+LDFLAGS = $(lib_opts) $(global_ld_flags)
+
+prereqs = sisutils rombuild rofsbuild patchdataprocessor
+
+srcs = \
+src/common.cpp \
+src/e32_image_reader.cpp \
+src/image_handler.cpp \
+src/image_reader.cpp \
+src/rofs_image_reader.cpp \
+src/rom_image_reader.cpp \
+../../imglib/e32uid/e32uid.cpp \
+../../imglib/host/h_file.cpp \
+../../imglib/host/h_mem.cpp \
+../../imglib/host/h_utl.cpp \
+../rofsbuild/r_build.cpp \
+../rofsbuild/r_coreimage.cpp \
+../rombuild/r_global.cpp \
+../../imglib/e32image/e32image.cpp \
+../../imglib/e32image/deflate/decode.cpp \
+../../imglib/e32image/deflate/encode.cpp \
+../../imglib/e32image/deflate/deflate.cpp \
+../../imglib/e32image/deflate/inflate.cpp \
+../../imglib/e32image/deflate/panic.cpp \
+../../imglib/e32image/deflate/compress.cpp \
+../../imglib/compress/pagedcompress.cpp \
+../../imglib/compress/byte_pair.cpp \
+../../imglib/patchdataprocessor/source/patchdataprocessor.cpp
+
+fixfiles = inc/image_reader.h src/image_reader.cpp src/rofs_image_reader.cpp src/rom_image_reader.cpp
+
+fixbackups = $(addsuffix .original,$(fixfiles))
+
+.PHONY: all clean $(prereqs) fixes remove_fixes
+
+all: $(exe)
+
+$(srcs): fixes
+
+bases = $(basename $(srcs))
+
+objs = $(addsuffix .o,$(bases))
+
+$(prereqs): $(global_prereqs)
+ $(MAKE) -C $(EPOCROOT)/build $@
+
+$(objs): $(prereqs)
+
+$(exe): $(objs)
+ $(CC) -o $@ $(objs) $(LDFLAGS)
+
+fixes:: $(fixbackups)
+
+clean: remove_fixes
+ rm -f $(objs) $(exe)
+
+inc/image_reader.h.original:
+ cp $(basename $@) $@ && \
+ sed -e 's|^#include <direct.h>||g' -i $(basename $@)
+
+src/image_reader.cpp.original:
+ cp $(basename $@) $@ && \
+ sed -e 's|_getcwd|GETCWD|g' -e 's|_chdir|CHDIR|g' -e 's|_mkdir|MKDIR|g' -e '/^#include "image_reader.h"/a\
+#if defined(_WIN32)\
+#include <direct.h>\
+#define GETCWD _getcwd\
+#define MKDIR _mkdir\
+#define CHDIR _chdir\
+#elif defined(__LINUX__)\
+#include <unistd.h>\
+#include <sys/stat.h>\
+#define GETCWD getcwd\
+#define MKDIR(d) mkdir(d,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)\
+#define CHDIR chdir\
+#else\
+#error Target OS not defined\
+#endif' -i -i $(basename $@)
+
+src/rofs_image_reader.cpp.original:
+ cp $(basename $@) $@ && \
+ sed -e 's|iInputFile->seekg(aOff, aStartPos);|iInputFile->seekg(aOff, SEEKDIR(aStartPos));|g' -e '/^#include "e32_image_reader.h"/a\
+#if defined(_WIN32)\
+#define SEEKDIR(pos) pos\
+#elif defined(__LINUX__)\
+#define SEEKDIR(pos) std::_Ios_Seekdir(pos)\
+#else\
+#error Target OS not defined\
+#endif' -i -i $(basename $@)
+
+src/rom_image_reader.cpp.original:
+ cp $(basename $@) $@ && \
+ sed -e 's|_alloca|ALLOCA|g' -e '/#include "r_rom.h"/a\
+#if defined(_WIN32)\
+#define ALLOCA _alloca\
+#elif defined(__LINUX__)\
+#include <alloca.h>\
+#define ALLOCA alloca\
+#else\
+#error Target OS not defined\
+#endif' -i -i $(basename $@)
+
+
+remove_fixes:
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
+
--- a/makefiles-garage/imgtools/romtools/rofsbuild/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/imgtools/romtools/rofsbuild/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -74,7 +74,9 @@
$(prereqs): $(global_prereqs)
$(MAKE) -C $(EPOCROOT)/build $@
-$(exe): $(objs) $(prereqs)
+$(objs): $(prereqs)
+
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
clean:
--- a/makefiles-garage/imgtools/romtools/rombuild/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/imgtools/romtools/rombuild/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -50,20 +50,54 @@
../../imglib/compress/byte_pair.cpp \
../../imglib/compress/pagedcompress.cpp
-.PHONY: all clean $(prereqs)
+fixfiles = rombuild.cpp r_global.cpp r_global.h
+fixbackups = $(addsuffix .original,$(fixfiles))
+
+.PHONY: all clean $(prereqs) fixes remove_fixes
all: $(exe)
+$(srcs): fixes
+
bases = $(basename $(srcs))
objs = $(addsuffix .o,$(bases))
$(prereqs): $(global_prereqs)
$(MAKE) -C $(EPOCROOT)/build $@
+
+$(objs): $(prereqs)
-$(exe): $(objs) $(prereqs)
+$(exe): $(objs)
$(CC) -o $@ $(objs) $(LDFLAGS)
-clean:
+clean: remove_fixes
rm -f $(objs) $(exe)
+fixes:: $(fixbackups)
+
+rombuild.cpp.original:
+ cp $(basename $@) $@ && \
+ sed -e 's|^TInt gCPUNum = 0;||g' \
+ -e 's|TInt gThreadNum = 0;||g' \
+ -e 's|char\* g_pCharCPUNum = NULL;||g' \
+ -e 's|TBool gGenDepGraph = EFalse;||g' \
+ -e 's|char\* gDepInfoFile = NULL;||g' -i $(basename $@)
+
+r_global.cpp.original:
+ cp $(basename $@) $@ && \
+ printf "TInt gCPUNum = 0;\nTInt gThreadNum = 0;\nchar* g_pCharCPUNum = NULL;\nTBool gGenDepGraph = EFalse;\nchar* gDepInfoFile = NULL;\n" >> $(basename $@)
+
+r_global.h.original:
+ cp $(basename $@) $@ && \
+ sed '/^extern TInt gPageIndexTableSize/a\
+extern TInt gCPUNum;\
+extern TInt gThreadNum;\
+extern char* g_pCharCPUNum;\
+extern TBool gGenDepGraph;\
+extern char* gDepInfoFile;' -i $(basename $@)
+
+
+remove_fixes:
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
+
--- a/makefiles-garage/imgtools/sisutils/Makefile Mon Nov 16 10:04:44 2009 +0000
+++ b/makefiles-garage/imgtools/sisutils/Makefile Fri Jan 08 16:16:51 2010 +0000
@@ -20,7 +20,47 @@
$(error EPOCROOT must be defined as the parent directory of your epoc32 tree)
endif
-todo_target = seclib
-include $(EPOCROOT)/build/makefiles-garage/todo.mk
-all: todo
+#todo_target = seclib
+#include $(EPOCROOT)/build/makefiles-garage/todo.mk
+#all: todo
+
+cpp_inc_paths = -I inc
+
+lib = libsisutils.a
+
+CPPFLAGS = $(cpp_inc_paths) $(global_cpp_flags)
+
+srcs = \
+src/sisutils.cpp \
+src/sis2iby.cpp \
+src/pkglanguage.cpp \
+src/pkgfileparser.cpp
+
+fixfiles = src/sisutils.cpp src/sis2iby.cpp src/pkgfileparser.cpp inc/pkgfileparser.h inc/sisutils.h
+fixbackups = $(addsuffix .original,$(fixfiles))
+
+all: $(lib)
+.PHONY: all clean fixes remove_fixes
+
+$(srcs): fixes
+
+bases = $(basename $(srcs))
+
+objs = $(addsuffix .o,$(bases))
+
+$(lib): $(objs)
+ ar r $@ $(objs)
+
+clean: remove_fixes
+ rm -f $(objs) $(lib)
+
+fixes:: $(fixbackups)
+
+$(fixbackups):
+ cp $(basename $@) $@ && \
+ cp -f $(EPOCROOT)/build/clobber/imgtools/sisutils/$(basename $@) $(EPOCROOT)/build/imgtools/sisutils/$(basename $@)
+
+remove_fixes:
+ for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
+