comparison Makefile @ 292:40ecbd5da481 ccdev

Part one of the C preprocessor This is part one of the C preprocessor. It finds and then fails to intepret directives. Also handles line splicing and trigraphs.
author William Astle <lost@l-w.ca>
date Sun, 08 Sep 2013 21:58:12 -0600
parents b67a118dbdb7
children c419b3b3d43f
comparison
equal deleted inserted replaced
291:83f682ed4d65 292:40ecbd5da481
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/driver/lwcc$(PROGSUFFIX) \
59 59 lwcc/cpp/lwcc-cpp$(PROGSUFFIX)
60 LWCC_LIBBIN_FILES = 60
61 LWCC_LIBBIN_FILES = lwcc/cpp/lwcc-cpp$(PROGSUFFIX)
61 LWCC_LIBLIB_FILES = 62 LWCC_LIBLIB_FILES =
62 LWCC_LIBINC_FILES = 63 LWCC_LIBINC_FILES =
63 64
64 .PHONY: all 65 .PHONY: all
65 all: $(MAIN_TARGETS) 66 all: $(MAIN_TARGETS)
98 lwcc_driver_srcs := main.c 99 lwcc_driver_srcs := main.c
99 lwcc_driver_srcs := $(addprefix lwcc/driver/,$(lwcc_driver_srcs)) 100 lwcc_driver_srcs := $(addprefix lwcc/driver/,$(lwcc_driver_srcs))
100 lwcc_driver_objs := $(lwcc_driver_srcs:.c=.o) 101 lwcc_driver_objs := $(lwcc_driver_srcs:.c=.o)
101 lwcc_driver_deps := $(lwcc_driver_srcs:.c=.d) 102 lwcc_driver_deps := $(lwcc_driver_srcs:.c=.d)
102 103
104 lwcc_cpp_srcs := main.c error.c file.c
105 lwcc_cpp_srcs := $(addprefix lwcc/cpp/,$(lwcc_cpp_srcs))
106 lwcc_cpp_objs := $(lwcc_cpp_srcs:.c=.o)
107 lwcc_cpp_deps := $(lwcc_cpp_srcs:.c=.d)
108
103 .PHONY: lwlink lwasm lwar lwobjdump lwcc 109 .PHONY: lwlink lwasm lwar lwobjdump lwcc
104 lwlink: lwlink/lwlink$(PROGSUFFIX) 110 lwlink: lwlink/lwlink$(PROGSUFFIX)
105 lwasm: lwasm/lwasm$(PROGSUFFIX) 111 lwasm: lwasm/lwasm$(PROGSUFFIX)
106 lwar: lwar/lwar$(PROGSUFFIX) 112 lwar: lwar/lwar$(PROGSUFFIX)
107 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX) 113 lwobjdump: lwlink/lwobjdump$(PROGSUFFIX)
108 lwcc: lwcc/driver/lwcc 114 lwcc: lwcc/driver/lwcc$(PROGSUFFIX)
115 lwcc-cpp: lwcc/cpp/lwcc-cpp$(PROGSUFFIX)
109 116
110 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib 117 lwasm/lwasm$(PROGSUFFIX): $(lwasm_objs) lwlib
111 @echo Linking $@ 118 @echo Linking $@
112 @$(CC) -o $@ $(lwasm_objs) $(LDFLAGS) 119 @$(CC) -o $@ $(lwasm_objs) $(LDFLAGS)
113 120
124 @$(CC) -o $@ $(lwar_objs) $(LDFLAGS) 131 @$(CC) -o $@ $(lwar_objs) $(LDFLAGS)
125 132
126 lwcc/driver/lwcc$(PROGSUFFIX): $(lwcc_driver_objs) lwlib 133 lwcc/driver/lwcc$(PROGSUFFIX): $(lwcc_driver_objs) lwlib
127 @echo Linking $@ 134 @echo Linking $@
128 @$(CC) -o $@ $(lwcc_driver_objs) $(LDFLAGS) 135 @$(CC) -o $@ $(lwcc_driver_objs) $(LDFLAGS)
136
137 lwcc/cpp/lwcc-cpp$(PROGSUFFIX): $(lwcc_cpp_objs) lwlib
138 @echo Linking $@
139 @$(CC) -o $@ $(lwcc_cpp_objs) $(LDFLAGS)
129 140
130 #.PHONY: lwlib 141 #.PHONY: lwlib
131 .INTERMEDIATE: lwlib 142 .INTERMEDIATE: lwlib
132 lwlib: lwlib/liblw.a 143 lwlib: lwlib/liblw.a
133 144
155 166
156 .PHONY: clean 167 .PHONY: clean
157 clean: $(cleantargs) 168 clean: $(cleantargs)
158 @echo "Cleaning up" 169 @echo "Cleaning up"
159 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX) 170 @rm -f lwlib/liblw.a lwasm/lwasm$(PROGSUFFIX) lwlink/lwlink$(PROGSUFFIX) lwlink/lwobjdump$(PROGSUFFIX) lwar/lwar$(PROGSUFFIX)
160 @rm -f lwcc/driver/lwcc$(PROGSUFFIX) 171 @rm -f lwcc/driver/lwcc$(PROGSUFFIX) lwcc/cpp/lwcc-cpp$(PROGSUFFIX)
161 @rm -f $(lwcc_driver_ojbs) 172 @rm -f $(lwcc_driver_ojbs) $(lwcc_preproc_objs)
162 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs) 173 @rm -f $(lwasm_objs) $(lwlink_objs) $(lwar_objs) $(lwlib_objs) $(lwobjdump_objs)
163 @rm -f $(extra_clean) 174 @rm -f $(extra_clean)
164 @rm -f */*.exe 175 @rm -f */*.exe
165 176
166 .PHONY: realclean 177 .PHONY: realclean
180 install -d $(LWCC_INSTALLLIBDIR) 191 install -d $(LWCC_INSTALLLIBDIR)
181 install -d $(LWCC_INSTALLLIBDIR)/bin 192 install -d $(LWCC_INSTALLLIBDIR)/bin
182 install -d $(LWCC_INSTALLLIBDIR)/lib 193 install -d $(LWCC_INSTALLLIBDIR)/lib
183 install -d $(LWCC_INSTALLLIBDIR)/include 194 install -d $(LWCC_INSTALLLIBDIR)/include
184 ifneq ($(LWCC_LIBBIN_FILES),) 195 ifneq ($(LWCC_LIBBIN_FILES),)
185 install $(LWCC_LIBBIN_FILES) $(LIBCC_INSTALLLIBDIR)/bin 196 install $(LWCC_LIBBIN_FILES) $(LWCC_INSTALLLIBDIR)/bin
186 endif 197 endif
187 ifneq ($(LWCC_LIBLIB_FILES),) 198 ifneq ($(LWCC_LIBLIB_FILES),)
188 install $(LWCC_LIBLIB_FILES) $(LIBCC_INSTALLLIBDIR)/lib 199 install $(LWCC_LIBLIB_FILES) $(LWCC_INSTALLLIBDIR)/lib
189 endif 200 endif
190 ifneq ($(LWCC_LIBINC_FILES),) 201 ifneq ($(LWCC_LIBINC_FILES),)
191 install $(LWCC_LIBINC_FILES) $(LIBCC_INSTALLLIBDIR)/include 202 install $(LWCC_LIBINC_FILES) $(LWCC_INSTALLLIBDIR)/include
192 endif 203 endif
193 204
194 .PHONY: test 205 .PHONY: test
195 test: all test/runtests 206 test: all test/runtests
196 @test/runtests 207 @test/runtests