Mercurial > hg > index.cgi
comparison Makefile @ 308:670ea8f90212 ccdev
Converted preproc logic to library and moved some utility stuff to lwlib
The strbuf and strpool stuff is generally useful so move it to lwlib where
other such things live.
Also, package the preprocessor logic into a library for easy use in multiple
places.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 21 Sep 2013 13:33:54 -0600 |
parents | d85d173ba120 |
children | 65ed8dde5331 |
comparison
equal
deleted
inserted
replaced
307:9e342c4e4b66 | 308:670ea8f90212 |
---|---|
67 | 67 |
68 lwar_srcs := add.c extract.c list.c lwar.c main.c remove.c replace.c | 68 lwar_srcs := add.c extract.c list.c lwar.c main.c remove.c replace.c |
69 lwar_srcs := $(addprefix lwar/,$(lwar_srcs)) | 69 lwar_srcs := $(addprefix lwar/,$(lwar_srcs)) |
70 | 70 |
71 lwlib_srcs := lw_alloc.c lw_realloc.c lw_free.c lw_error.c lw_expr.c \ | 71 lwlib_srcs := lw_alloc.c lw_realloc.c lw_free.c lw_error.c lw_expr.c \ |
72 lw_stack.c lw_string.c lw_stringlist.c lw_cmdline.c | 72 lw_stack.c lw_string.c lw_stringlist.c lw_cmdline.c lw_strbuf.c \ |
73 lw_strpool.c | |
73 lwlib_srcs := $(addprefix lwlib/,$(lwlib_srcs)) | 74 lwlib_srcs := $(addprefix lwlib/,$(lwlib_srcs)) |
74 | 75 |
75 lwlink_srcs := main.c lwlink.c readfiles.c expr.c script.c link.c output.c map.c | 76 lwlink_srcs := main.c lwlink.c readfiles.c expr.c script.c link.c output.c map.c |
76 lwobjdump_srcs := objdump.c | 77 lwobjdump_srcs := objdump.c |
77 lwlink_srcs := $(addprefix lwlink/,$(lwlink_srcs)) | 78 lwlink_srcs := $(addprefix lwlink/,$(lwlink_srcs)) |
99 lwcc_driver_srcs := driver-main.c | 100 lwcc_driver_srcs := driver-main.c |
100 lwcc_driver_srcs := $(addprefix lwcc/,$(lwcc_driver_srcs)) | 101 lwcc_driver_srcs := $(addprefix lwcc/,$(lwcc_driver_srcs)) |
101 lwcc_driver_objs := $(lwcc_driver_srcs:.c=.o) | 102 lwcc_driver_objs := $(lwcc_driver_srcs:.c=.o) |
102 lwcc_driver_deps := $(lwcc_driver_srcs:.c=.d) | 103 lwcc_driver_deps := $(lwcc_driver_srcs:.c=.d) |
103 | 104 |
104 lwcc_cpp_srcs := cpp-main.c cpp.c lex.c strbuf.c token.c preproc.c symbol.c strpool.c | 105 lwcc_cpp_srcs := cpp-main.c |
105 lwcc_cpp_srcs := $(addprefix lwcc/,$(lwcc_cpp_srcs)) | 106 lwcc_cpp_srcs := $(addprefix lwcc/,$(lwcc_cpp_srcs)) |
106 lwcc_cpp_objs := $(lwcc_cpp_srcs:.c=.o) | 107 lwcc_cpp_objs := $(lwcc_cpp_srcs:.c=.o) |
107 lwcc_cpp_deps := $(lwcc_cpp_srcs:.c=.d) | 108 lwcc_cpp_deps := $(lwcc_cpp_srcs:.c=.d) |
108 | 109 |
109 lwcc_deps := $(lwcc_cpp_deps) $(lwcc_driver_deps) | 110 lwcc_cpplib_srcs := cpp.c lex.c token.c preproc.c symbol.c |
111 lwcc_cpplib_srcs := $(addprefix lwcc/,$(lwcc_cpplib_srcs)) | |
112 lwcc_cpplib_objs := $(lwcc_cpplib_srcs:.c=.o) | |
113 lwcc_cpplib_deps := $(lwcc_cpplib_srcs:.c=.d) | |
114 | |
115 lwcc_deps := $(lwcc_cpp_deps) $(lwcc_driver_deps) $(lwcc_cpplib_deps) | |
110 | 116 |
111 .PHONY: lwlink lwasm lwar lwobjdump lwcc | 117 .PHONY: lwlink lwasm lwar lwobjdump lwcc |
112 lwlink: lwlink/lwlink$(PROGSUFFIX) | 118 lwlink: lwlink/lwlink$(PROGSUFFIX) |
113 lwasm: lwasm/lwasm$(PROGSUFFIX) | 119 lwasm: lwasm/lwasm$(PROGSUFFIX) |
114 lwar: lwar/lwar$(PROGSUFFIX) | 120 lwar: lwar/lwar$(PROGSUFFIX) |
115 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX) | 121 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX) |
116 lwcc: lwcc/lwcc$(PROGSUFFIX) | 122 lwcc: lwcc/lwcc$(PROGSUFFIX) |
117 lwcc-cpp: lwcc/lwcc-cpp$(PROGSUFFIX) | 123 lwcc-cpp: lwcc/lwcc-cpp$(PROGSUFFIX) |
124 lwcc-cpplib: lwcc/libcpp.a | |
118 | 125 |
119 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib | 126 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib |
120 @echo Linking $@ | 127 @echo Linking $@ |
121 @$(CC) -o $@ $(lwasm_objs) $(LDFLAGS) | 128 @$(CC) -o $@ $(lwasm_objs) $(LDFLAGS) |
122 | 129 |
134 | 141 |
135 lwcc/lwcc$(PROGSUFFIX): $(lwcc_driver_objs) lwlib | 142 lwcc/lwcc$(PROGSUFFIX): $(lwcc_driver_objs) lwlib |
136 @echo Linking $@ | 143 @echo Linking $@ |
137 @$(CC) -o $@ $(lwcc_driver_objs) $(LDFLAGS) | 144 @$(CC) -o $@ $(lwcc_driver_objs) $(LDFLAGS) |
138 | 145 |
139 lwcc/lwcc-cpp$(PROGSUFFIX): $(lwcc_cpp_objs) lwlib | 146 lwcc/lwcc-cpp$(PROGSUFFIX): $(lwcc_cpp_objs) lwlib lwcc-cpplib |
140 @echo Linking $@ | 147 @echo Linking $@ |
141 @$(CC) -o $@ $(lwcc_cpp_objs) $(LDFLAGS) | 148 @$(CC) -o $@ $(lwcc_cpp_objs) lwcc/libcpp.a $(LDFLAGS) |
149 | |
150 .INTERMEDIATE: lwcc-cpplib | |
151 lwcc-cpplib: lwcc/libcpp.a | |
152 lwcc/libcpp.a: $(lwcc_cpplib_objs) | |
153 @echo Linking $@ | |
154 @$(AR) rc $@ $(lwcc_cpplib_objs) | |
155 @$(RANLIB) $@ | |
142 | 156 |
143 #.PHONY: lwlib | 157 #.PHONY: lwlib |
144 .INTERMEDIATE: lwlib | 158 .INTERMEDIATE: lwlib |
145 lwlib: lwlib/liblw.a | 159 lwlib: lwlib/liblw.a |
146 | 160 |
168 | 182 |
169 .PHONY: clean | 183 .PHONY: clean |
170 clean: $(cleantargs) | 184 clean: $(cleantargs) |
171 @echo "Cleaning up" | 185 @echo "Cleaning up" |
172 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX) | 186 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX) |
173 @rm -f lwcc/lwcc$(PROGSUFFIX) lwcc/lwcc-cpp$(PROGSUFFIX) | 187 @rm -f lwcc/lwcc$(PROGSUFFIX) lwcc/lwcc-cpp$(PROGSUFFIX) lwcc/libcpp.a |
174 @rm -f $(lwcc_driver_ojbs) $(lwcc_cpp_objs) | 188 @rm -f $(lwcc_driver_objs) $(lwcc_cpp_objs) $(lwcc_cpplib_objs) |
175 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs) | 189 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs) |
176 @rm -f $(extra_clean) | 190 @rm -f $(extra_clean) |
177 @rm -f */*.exe | 191 @rm -f */*.exe |
178 | 192 |
179 .PHONY: realclean | 193 .PHONY: realclean |
180 realclean: clean $(realcleantargs) | 194 realclean: clean $(realcleantargs) |
181 @echo "Cleaning up even more" | 195 @echo "Cleaning up even more" |
182 @rm -f $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) $(lwobjdump_deps) | 196 @rm -f $(lwasm_deps) $(lwlink_deps) $(lwar_deps) $(lwlib_deps) $(lwobjdump_deps) |
183 @rm -f $(lwcc_driver_deps) $(lwcc_cpp_deps) | 197 @rm -f $(lwcc_driver_deps) $(lwcc_cpp_deps) $(lwcc_cpplib_deps) |
184 @rm -f docs/manual/*.html docs/manual/*.pdf | 198 @rm -f docs/manual/*.html docs/manual/*.pdf |
185 | 199 |
186 print-%: | 200 print-%: |
187 @echo $* = $($*) | 201 @echo $* = $($*) |
188 | 202 |