makefiles-garage/imgtools/romtools/rombuild/Makefile
changeset 1 820b22e13ff1
parent 0 37428ad74fc2
equal deleted inserted replaced
0:37428ad74fc2 1:820b22e13ff1
    48 ../../imglib/e32image/deflate/inflate.cpp ../../imglib/e32image/deflate/panic.cpp \
    48 ../../imglib/e32image/deflate/inflate.cpp ../../imglib/e32image/deflate/panic.cpp \
    49 ../../imglib/e32image/deflate/compress.cpp \
    49 ../../imglib/e32image/deflate/compress.cpp \
    50 ../../imglib/compress/byte_pair.cpp \
    50 ../../imglib/compress/byte_pair.cpp \
    51 ../../imglib/compress/pagedcompress.cpp
    51 ../../imglib/compress/pagedcompress.cpp
    52 
    52 
    53 .PHONY: all clean $(prereqs)
    53 fixfiles = rombuild.cpp r_global.cpp r_global.h
       
    54 fixbackups = $(addsuffix .original,$(fixfiles)) 
       
    55 
       
    56 .PHONY: all clean $(prereqs) fixes remove_fixes
    54 
    57 
    55 all: $(exe)
    58 all: $(exe)
       
    59 
       
    60 $(srcs): fixes
    56 
    61 
    57 bases = $(basename $(srcs))
    62 bases = $(basename $(srcs))
    58 
    63 
    59 objs = $(addsuffix .o,$(bases))
    64 objs = $(addsuffix .o,$(bases))
    60 
    65 
    61 $(prereqs): $(global_prereqs)
    66 $(prereqs): $(global_prereqs)
    62 	$(MAKE) -C $(EPOCROOT)/build $@
    67 	$(MAKE) -C $(EPOCROOT)/build $@
       
    68 
       
    69 $(objs): $(prereqs)
    63  
    70  
    64 $(exe): $(objs) $(prereqs)
    71 $(exe): $(objs) 
    65 	$(CC) -o $@ $(objs) $(LDFLAGS)
    72 	$(CC) -o $@ $(objs) $(LDFLAGS)
    66 
    73 
    67 clean:
    74 clean: remove_fixes
    68 	rm -f $(objs) $(exe)
    75 	rm -f $(objs) $(exe)
    69 
    76 
       
    77 fixes:: $(fixbackups)
       
    78 
       
    79 rombuild.cpp.original:
       
    80 	cp $(basename $@) $@ && \
       
    81 	sed -e 's|^TInt gCPUNum = 0;||g' \
       
    82 		-e 's|TInt gThreadNum = 0;||g' \
       
    83 		-e 's|char\* g_pCharCPUNum = NULL;||g' \
       
    84 		-e 's|TBool gGenDepGraph = EFalse;||g' \
       
    85 		-e 's|char\* gDepInfoFile = NULL;||g' -i $(basename $@)
       
    86 
       
    87 r_global.cpp.original:
       
    88 	cp $(basename $@) $@ && \
       
    89 	printf "TInt gCPUNum = 0;\nTInt gThreadNum = 0;\nchar* g_pCharCPUNum = NULL;\nTBool gGenDepGraph = EFalse;\nchar* gDepInfoFile = NULL;\n" >> $(basename $@)
       
    90 
       
    91 r_global.h.original:
       
    92 	cp $(basename $@) $@ && \
       
    93 	sed '/^extern TInt gPageIndexTableSize/a\
       
    94 extern TInt gCPUNum;\
       
    95 extern TInt gThreadNum;\
       
    96 extern char* g_pCharCPUNum;\
       
    97 extern TBool gGenDepGraph;\
       
    98 extern char* gDepInfoFile;'  -i $(basename $@)
       
    99 
       
   100 
       
   101 remove_fixes: 
       
   102 	for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done
       
   103