11 # Contributors: |
11 # Contributors: |
12 # |
12 # |
13 # Description: |
13 # Description: |
14 # This is a Linux makefile for rcomp. |
14 # This is a Linux makefile for rcomp. |
15 |
15 |
|
16 # Need to make symklinks rcomp.l -> RCOMP.LEX, rcomp.y -> RCOMP.YACC |
16 |
17 |
17 ifdef EPOCROOT |
18 ifdef EPOCROOT |
18 include $(EPOCROOT)/build/makefiles-garage/global-make-env.mk |
19 include $(EPOCROOT)/build/makefiles-garage/global-make-env.mk |
19 else |
20 else |
20 $(error EPOCROOT must be defined as the parent directory of your epoc32 tree) |
21 $(error EPOCROOT must be defined as the parent directory of your epoc32 tree) |
21 endif |
22 endif |
22 |
23 |
23 todo_target = rcomp |
24 cpp_inc_paths = -I inc -I src |
24 include $(EPOCROOT)/build/makefiles-garage/todo.mk |
|
25 all: todo |
|
26 |
25 |
|
26 lib_opts = |
|
27 |
|
28 exe = rcomp |
|
29 |
|
30 CPPFLAGS = $(cpp_inc_paths) $(global_cpp_flags) |
|
31 LDFLAGS = $(lib_opts) $(global_ld_flags) |
|
32 |
|
33 prereqs = |
|
34 |
|
35 ucase_lexyaccfiles = src/RCOMP.LEX src/RCOMP.YACC |
|
36 lcase_lexyaccfiles = $(shell echo $(ucase_lexyaccfiles) | tr '[:upper:]' '[:lower:]') |
|
37 |
|
38 ucase_srcfiles = \ |
|
39 src/ARRAY.CPP \ |
|
40 src/ASTRING.CPP \ |
|
41 src/CCODES.CPP \ |
|
42 src/CTABLE.CPP \ |
|
43 src/DATATYPE.CPP \ |
|
44 src/ERRORHAN.CPP \ |
|
45 src/FILEACC.CPP \ |
|
46 src/FILELINE.CPP \ |
|
47 src/INDEXTAB.CPP \ |
|
48 src/LINKLIST.CPP \ |
|
49 src/MEM.CPP \ |
|
50 src/NAMEIDMA.CPP \ |
|
51 src/NUMVAL.CPP \ |
|
52 src/RCBINSTR.CPP \ |
|
53 src/RCOSTRM.CPP \ |
|
54 src/RCSCAN.CPP \ |
|
55 src/RCSTACK.CPP \ |
|
56 src/RESOURCE.CPP \ |
|
57 src/STACK.CPP \ |
|
58 src/STRINGAR.CPP \ |
|
59 src/STRUCTST.CPP \ |
|
60 src/UNICODE_COMPRESSOR.CPP \ |
|
61 src/QUALIFAR.CPP |
|
62 |
|
63 lcase_srcfiles = $(shell echo $(ucase_srcfiles) | tr '[:upper:]' '[:lower:]') |
|
64 |
|
65 srcs = src/main.cpp \ |
|
66 src/localise.cpp \ |
|
67 src/messages.cpp \ |
|
68 src/rcompl.cpp \ |
|
69 src/rcomp.cpp $(lcase_srcfiles) |
|
70 |
|
71 ifneq "$(wildcard inc/*.H.original)" "" |
|
72 ucase_headers := $(basename $(wildcard inc/*.H.original)) |
|
73 else |
|
74 ucase_headers := $(wildcard inc/*.H) |
|
75 endif |
|
76 |
|
77 lcase_headers = $(shell echo $(ucase_headers) | tr '[:upper:]' '[:lower:]') |
|
78 |
|
79 fixfiles = $(ucase_srcfiles) $(ucase_lexyaccfiles) $(ucase_headers) inc/Parser.h |
|
80 fixedfiles = $(lcase_srcfiles) $(lcase_lexyaccfiles) $(lcase_headers) inc/parser.h |
|
81 fixbackups = $(addsuffix .original,$(fixfiles)) |
|
82 |
|
83 .PHONY: all clean $(prereqs) fixes remove_fixes |
|
84 |
|
85 all: $(exe) |
|
86 |
|
87 $(srcs): fixes |
|
88 |
|
89 bases = $(basename $(srcs)) |
|
90 |
|
91 objs = $(addsuffix .o,$(bases)) |
|
92 |
|
93 $(prereqs): $(global_prereqs) |
|
94 $(MAKE) -C $(EPOCROOT)/build $@ |
|
95 |
|
96 $(objs): $(prereqs) |
|
97 |
|
98 $(exe): $(objs) |
|
99 $(CC) -o $@ $(objs) $(LDFLAGS) |
|
100 |
|
101 fixes:: $(fixbackups) |
|
102 for uchdr in $(ucase_headers) inc/Parser.h; do \ |
|
103 uchdr=$${uchdr##inc/} && \ |
|
104 lchdr=`echo $$uchdr | tr '[:upper:]' '[:lower:]'` && \ |
|
105 uchdr=$${uchdr/./\\.} && \ |
|
106 for file in $(srcs) inc/*.h; do \ |
|
107 sed -e "s|$$uchdr|$$lchdr|g" -i $$file; \ |
|
108 done; \ |
|
109 done && \ |
|
110 sed -e 's|^typedef bool TBool;||g' -i inc/unicode_compressor.h |
|
111 |
|
112 $(fixbackups): |
|
113 ucfile=$(basename $@) && \ |
|
114 cp $$ucfile $@ && \ |
|
115 lcfile=`echo $$ucfile | tr '[:upper:]' '[:lower:]'` && \ |
|
116 mv $$ucfile $$lcfile |
|
117 |
|
118 clean: remove_fixes |
|
119 rm -f $(objs) $(exe) |
|
120 |
|
121 remove_fixes: |
|
122 rm -f $(fixedfiles) |
|
123 for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%\.original}; fi; done |
|
124 |