comparison Makefile @ 295:4b17780f2777 ccdev

Checkpoint lwcc development Changed tactics with the preprocessor. Instead of getting clever and trying to do things the "fast" way, instead, just tokenize the whole input and process it that way. Also, set up so the preprocessor and compiler can be integrated instead of having to have a specifically correct output for the preprocessed file. Also removed the subdirectories in the lwcc directory. It made things more complicated than they needed to be.
author William Astle <lost@l-w.ca>
date Thu, 12 Sep 2013 22:06:26 -0600
parents 048adfee2933
children 83fcc1ed6ad6
comparison
equal deleted inserted replaced
294:048adfee2933 295:4b17780f2777
53 53
54 MAIN_TARGETS := lwasm/lwasm$(PROGSUFFIX) \ 54 MAIN_TARGETS := lwasm/lwasm$(PROGSUFFIX) \
55 lwlink/lwlink$(PROGSUFFIX) \ 55 lwlink/lwlink$(PROGSUFFIX) \
56 lwar/lwar$(PROGSUFFIX) \ 56 lwar/lwar$(PROGSUFFIX) \
57 lwlink/lwobjdump$(PROGSUFFIX) \ 57 lwlink/lwobjdump$(PROGSUFFIX) \
58 lwcc/driver/lwcc$(PROGSUFFIX) \ 58 lwcc/lwcc$(PROGSUFFIX) \
59 lwcc/cpp/lwcc-cpp$(PROGSUFFIX) 59 lwcc/lwcc-cpp$(PROGSUFFIX)
60 60
61 LWCC_LIBBIN_FILES = lwcc/cpp/lwcc-cpp$(PROGSUFFIX) 61 LWCC_LIBBIN_FILES = lwcc/lwcc-cpp$(PROGSUFFIX)
62 LWCC_LIBLIB_FILES = 62 LWCC_LIBLIB_FILES =
63 LWCC_LIBINC_FILES = 63 LWCC_LIBINC_FILES =
64 64
65 .PHONY: all 65 .PHONY: all
66 all: $(MAIN_TARGETS) 66 all: $(MAIN_TARGETS)
94 lwlink_deps := $(lwlink_srcs:.c=.d) 94 lwlink_deps := $(lwlink_srcs:.c=.d)
95 lwar_deps := $(lwar_srcs:.c=.d) 95 lwar_deps := $(lwar_srcs:.c=.d)
96 lwlib_deps := $(lwlib_srcs:.c=.d) 96 lwlib_deps := $(lwlib_srcs:.c=.d)
97 lwobjdump_deps := $(lwobjdump_srcs:.c=.d) 97 lwobjdump_deps := $(lwobjdump_srcs:.c=.d)
98 98
99 lwcc_driver_srcs := main.c 99 lwcc_driver_srcs := driver-main.c
100 lwcc_driver_srcs := $(addprefix lwcc/driver/,$(lwcc_driver_srcs)) 100 lwcc_driver_srcs := $(addprefix lwcc/,$(lwcc_driver_srcs))
101 lwcc_driver_objs := $(lwcc_driver_srcs:.c=.o) 101 lwcc_driver_objs := $(lwcc_driver_srcs:.c=.o)
102 lwcc_driver_deps := $(lwcc_driver_srcs:.c=.d) 102 lwcc_driver_deps := $(lwcc_driver_srcs:.c=.d)
103 103
104 lwcc_cpp_srcs := main.c error.c file.c preproc.c char_p.c symbol.c 104 lwcc_cpp_srcs := cpp-main.c cpp.c lex.c strbuf.c token.c
105 lwcc_cpp_srcs := $(addprefix lwcc/cpp/,$(lwcc_cpp_srcs)) 105 lwcc_cpp_srcs := $(addprefix lwcc/,$(lwcc_cpp_srcs))
106 lwcc_cpp_objs := $(lwcc_cpp_srcs:.c=.o) 106 lwcc_cpp_objs := $(lwcc_cpp_srcs:.c=.o)
107 lwcc_cpp_deps := $(lwcc_cpp_srcs:.c=.d) 107 lwcc_cpp_deps := $(lwcc_cpp_srcs:.c=.d)
108
109 lwcc_deps := $(lwcc_cpp_deps) $(lwcc_driver_deps)
108 110
109 .PHONY: lwlink lwasm lwar lwobjdump lwcc 111 .PHONY: lwlink lwasm lwar lwobjdump lwcc
110 lwlink: lwlink/lwlink$(PROGSUFFIX) 112 lwlink: lwlink/lwlink$(PROGSUFFIX)
111 lwasm: lwasm/lwasm$(PROGSUFFIX) 113 lwasm: lwasm/lwasm$(PROGSUFFIX)
112 lwar: lwar/lwar$(PROGSUFFIX) 114 lwar: lwar/lwar$(PROGSUFFIX)
113 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX) 115 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX)
114 lwcc: lwcc/driver/lwcc$(PROGSUFFIX) 116 lwcc: lwcc/lwcc$(PROGSUFFIX)
115 lwcc-cpp: lwcc/cpp/lwcc-cpp$(PROGSUFFIX) 117 lwcc-cpp: lwcc/lwcc-cpp$(PROGSUFFIX)
116 118
117 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib 119 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib
118 @echo Linking $@ 120 @echo Linking $@
119 @$(CC) -o $@ $(lwasm_objs) $(LDFLAGS) 121 @$(CC) -o $@ $(lwasm_objs) $(LDFLAGS)
120 122
128 130
129 lwar/lwar$(PROGSUFFIX): $(lwar_objs) lwlib 131 lwar/lwar$(PROGSUFFIX): $(lwar_objs) lwlib
130 @echo Linking $@ 132 @echo Linking $@
131 @$(CC) -o $@ $(lwar_objs) $(LDFLAGS) 133 @$(CC) -o $@ $(lwar_objs) $(LDFLAGS)
132 134
133 lwcc/driver/lwcc$(PROGSUFFIX): $(lwcc_driver_objs) lwlib 135 lwcc/lwcc$(PROGSUFFIX): $(lwcc_driver_objs) lwlib
134 @echo Linking $@ 136 @echo Linking $@
135 @$(CC) -o $@ $(lwcc_driver_objs) $(LDFLAGS) 137 @$(CC) -o $@ $(lwcc_driver_objs) $(LDFLAGS)
136 138
137 lwcc/cpp/lwcc-cpp$(PROGSUFFIX): $(lwcc_cpp_objs) lwlib 139 lwcc/lwcc-cpp$(PROGSUFFIX): $(lwcc_cpp_objs) lwlib
138 @echo Linking $@ 140 @echo Linking $@
139 @$(CC) -o $@ $(lwcc_cpp_objs) $(LDFLAGS) 141 @$(CC) -o $@ $(lwcc_cpp_objs) $(LDFLAGS)
140 142
141 #.PHONY: lwlib 143 #.PHONY: lwlib
142 .INTERMEDIATE: lwlib 144 .INTERMEDIATE: lwlib
166 168
167 .PHONY: clean 169 .PHONY: clean
168 clean: $(cleantargs) 170 clean: $(cleantargs)
169 @echo "Cleaning up" 171 @echo "Cleaning up"
170 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX) 172 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX)
171 @rm -f lwcc/driver/lwcc$(PROGSUFFIX) lwcc/cpp/lwcc-cpp$(PROGSUFFIX) 173 @rm -f lwcc/lwcc$(PROGSUFFIX) lwcc/lwcc-cpp$(PROGSUFFIX)
172 @rm -f $(lwcc_driver_ojbs) $(lwcc_cpp_objs) 174 @rm -f $(lwcc_driver_ojbs) $(lwcc_cpp_objs)
173 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs) 175 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs)
174 @rm -f $(extra_clean) 176 @rm -f $(extra_clean)
175 @rm -f */*.exe 177 @rm -f */*.exe
176 178