Add test for __*LP*__ predefined macros
[tinycc.git] / Makefile
blob1488c1be77613e988c51ddfce42bffee1c214f1e
2 # Tiny C Compiler Makefile
5 TOP ?= .
6 include $(TOP)/config.mak
7 VPATH = $(top_srcdir)
9 CPPFLAGS += -I$(TOP) # for config.h
11 ifneq (-$(findstring gcc,$(CC))-,-gcc-)
12 ifeq (-$(findstring clang,$(CC))-,-clang-)
13 # make clang accept gnuisms in libtcc1.c
14 CFLAGS+=-fheinous-gnu-extensions
15 endif
16 endif
18 CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
19 CFLAGS_P=$(CFLAGS) -pg -static
20 LIBS_P=
21 LDFLAGS_P=$(LDFLAGS)
23 ifdef CONFIG_WIN64
24 CONFIG_WIN32=yes
25 endif
27 ifndef CONFIG_WIN32
28 LIBS=-lm
29 ifndef CONFIG_NOLDL
30 LIBS+=-ldl
31 endif
32 endif
34 # make libtcc as static or dynamic library?
35 ifdef DISABLE_STATIC
36 ifndef CONFIG_WIN32
37 LIBTCC=libtcc.so.1.0
38 else
39 LIBTCC=libtcc.dll
40 LIBTCC_DLL=yes
41 LIBTCC_EXTRA=libtcc.def libtcc.a
42 endif
43 LINK_LIBTCC=-Wl,-rpath,"$(libdir)"
44 ifdef DISABLE_RPATH
45 LINK_LIBTCC=
46 endif
47 else
48 LIBTCC=libtcc.a
49 LINK_LIBTCC=
50 endif
52 CONFIG_$(ARCH) = yes
53 NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386
54 NATIVE_DEFINES_$(CONFIG_x86-64) += -DTCC_TARGET_X86_64
55 NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE
56 NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC
57 NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM
58 NATIVE_DEFINES_$(CONFIG_arm_eabihf) += -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
59 NATIVE_DEFINES_$(CONFIG_arm_eabi) += -DTCC_ARM_EABI
60 NATIVE_DEFINES_$(CONFIG_arm_vfp) += -DTCC_ARM_VFP
61 NATIVE_DEFINES_$(CONFIG_arm64) += -DTCC_TARGET_ARM64
62 NATIVE_DEFINES += $(NATIVE_DEFINES_yes)
64 ifeq ($(TOP),.)
66 PROGS=tcc$(EXESUF)
67 I386_CROSS = i386-linux-gnu-tcc$(EXESUF)
68 WIN32_CROSS = i386-win-mingw32-tcc$(EXESUF)
69 WIN64_CROSS = x86_64-win-mingw32-tcc$(EXESUF)
70 WINCE_CROSS = arm-win-mingw32ce-tcc$(EXESUF)
71 X64_CROSS = x86_64-linux-gnu-tcc$(EXESUF)
72 ARM_FPA_CROSS = arm-linux-fpa-tcc$(EXESUF)
73 ARM_FPA_LD_CROSS = arm-linux-fpa-ld-tcc$(EXESUF)
74 ARM_VFP_CROSS = arm-linux-gnu-tcc$(EXESUF)
75 ARM_EABI_CROSS = arm-linux-gnueabi-tcc$(EXESUF)
76 ARM_EABIHF_CROSS = arm-linux-gnueabihf-tcc$(EXESUF)
77 ARM_CROSS = $(ARM_FPA_CROSS) $(ARM_FPA_LD_CROSS) $(ARM_VFP_CROSS) $(ARM_EABI_CROSS)
78 ARM64_CROSS = arm64-tcc$(EXESUF)
79 C67_CROSS = c67-tcc$(EXESUF)
81 # Legacy symlinks for cross compilers
82 $(I386_CROSS)_LINK = i386-tcc$(EXESUF)
83 $(WIN32_CROSS)_LINK = i386-win-tcc$(EXESUF)
84 $(WIN64_CROSS)_LINK = x86_64-win-tcc$(EXESUF)
85 $(WINCE_CROSS)_LINK = arm-win-tcc$(EXESUF)
86 $(X64_CROSS)_LINK = x86_64-tcc$(EXESUF)
87 $(ARM_FPA_CROSS)_LINK = arm-fpa-tcc$(EXESUF)
88 $(ARM_FPA_LD_CROSS)_LINK = arm-fpa-ld-tcc$(EXESUF)
89 $(ARM_VFP_CROSS)_LINK = arm-vfp-tcc$(EXESUF)
90 $(ARM_EABI_CROSS)_LINK = arm-eabi-tcc$(EXESUF)
92 ifeq ($(TARGETOS),Windows)
93 ifeq ($(ARCH),i386)
94 PROGS:=$($(WIN32_CROSS)_LINK)
95 $($(WIN32_CROSS)_LINK)_TCC = yes
96 endif
97 ifeq ($(ARCH),x86-64)
98 PROGS:=$($(WIN64_CROSS)_LINK)
99 $($(WIN64_CROSS)_LINK)_TCC = yes
100 endif
101 endif
103 ifeq ($(TARGETOS),Linux)
104 ifeq ($(ARCH),i386)
105 PROGS:=$($(I386_CROSS)_LINK)
106 $($(I386_CROSS)_LINK)_TCC = yes
107 endif
108 ifeq ($(ARCH),x86-64)
109 PROGS:=$($(X64_CROSS)_LINK)
110 $($(X64_CROSS)_LINK)_TCC = yes
111 endif
112 endif
114 CORE_FILES = tcc.c libtcc.c tccpp.c tccgen.c tccelf.c tccasm.c tccrun.c
115 CORE_FILES += tcc.h config.h libtcc.h tcctok.h
116 I386_FILES = $(CORE_FILES) i386-gen.c i386-asm.c i386-asm.h i386-tok.h
117 WIN32_FILES = $(CORE_FILES) i386-gen.c i386-asm.c i386-asm.h i386-tok.h tccpe.c
118 WIN64_FILES = $(CORE_FILES) x86_64-gen.c i386-asm.c x86_64-asm.h tccpe.c
119 WINCE_FILES = $(CORE_FILES) arm-gen.c tccpe.c
120 X86_64_FILES = $(CORE_FILES) x86_64-gen.c i386-asm.c x86_64-asm.h
121 ARM_FILES = $(CORE_FILES) arm-gen.c
122 ARM64_FILES = $(CORE_FILES) arm64-gen.c
123 C67_FILES = $(CORE_FILES) c67-gen.c tcccoff.c
125 ifdef CONFIG_WIN64
126 PROGS+=tiny_impdef$(EXESUF)
127 NATIVE_FILES=$(WIN64_FILES)
128 PROGS_CROSS=$(WIN32_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
129 LIBTCC1_CROSS=lib/i386-win/libtcc1.a
130 LIBTCC1=libtcc1.a
131 else ifdef CONFIG_WIN32
132 PROGS+=tiny_impdef$(EXESUF)
133 NATIVE_FILES=$(WIN32_FILES)
134 PROGS_CROSS=$(WIN64_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
135 LIBTCC1_CROSS=lib/x86_64-win/libtcc1.a
136 LIBTCC1=libtcc1.a
137 else ifeq ($(ARCH),i386)
138 NATIVE_FILES=$(I386_FILES)
139 PROGS_CROSS=$($(X64_CROSS)_LINK) $($(WIN32_CROSS)_LINK) $($(WIN64_CROSS)_LINK) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
140 LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a lib/x86_64/libtcc1.a \
141 lib/arm64/libtcc1.a
142 LIBTCC1=libtcc1.a
143 else ifeq ($(ARCH),x86-64)
144 ifeq ($(TARGETOS),Darwin)
145 NATIVE_FILES=$(X86_64_FILES)
146 PROGS_CROSS=$($(I386_CROSS)_LINK) $($(WIN32_CROSS)_LINK) $($(WIN64_CROSS)_LINK) $(ARM_CROSS) $(C67_CROSS) $(WINCE_CROSS)
147 LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a lib/x86_64/libtcc1.a
148 LIBTCC1=libtcc1.a
149 else
150 NATIVE_FILES=$(X86_64_FILES)
151 PROGS_CROSS=$($(I386_CROSS)_LINK) $($(WIN32_CROSS)_LINK) $($(WIN64_CROSS)_LINK) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
152 LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a lib/x86_64/libtcc1.a \
153 lib/arm64/libtcc1.a
154 LIBTCC1=libtcc1.a
155 endif
156 else ifeq ($(ARCH),arm)
157 NATIVE_FILES=$(ARM_FILES)
158 PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
159 LIBTCC1=libtcc1.a
160 LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a
161 else ifeq ($(ARCH),arm64)
162 NATIVE_FILES=$(ARM64_FILES)
163 PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(C67_CROSS) $(WINCE_CROSS)
164 LIBTCC1=libtcc1.a
165 LIBTCC1_CROSS=lib/i386-win/libtcc1.a lib/x86_64-win/libtcc1.a lib/i386/libtcc1.a
166 endif
167 PROGS_CROSS_LINK=$(foreach PROG_CROSS,$(PROGS_CROSS),$($(PROG_CROSS)_LINK))
169 PROGS+=tiny_libmaker$(EXESUF)
171 TCCLIBS = $(LIBTCC1) $(LIBTCC) $(LIBTCC_EXTRA)
172 TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info
174 ifdef CONFIG_CROSS
175 PROGS+=$(PROGS_CROSS)
176 TCCLIBS+=$(LIBTCC1_CROSS)
177 endif
179 all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
181 # Host Tiny C Compiler
182 tcc$(EXESUF): tcc.o $(LIBTCC)
183 $(CC) -o $@ $^ $(LIBS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LINK_LIBTCC)
185 # Cross Tiny C Compilers
186 %-tcc$(EXESUF): tcc.c
187 $(CC) -o $@ $< -DONE_SOURCE $(if $($@_TCC),$(NATIVE_DEFINES),$(DEFINES)) $(CPPFLAGS) $(CFLAGS) $(LIBS) $(LDFLAGS)
188 $(if $($@_LINK),ln -sf $@ $($@_LINK))
189 $(if $($@_TCC),ln -sf $@ tcc$(EXESUF))
191 # profiling version
192 tcc_p$(EXESUF): $(NATIVE_FILES)
193 $(CC) -o $@ $< -DONE_SOURCE $(NATIVE_DEFINES) $(CPPFLAGS_P) $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P)
195 $(I386_CROSS) $($(I386_CROSS)_LINK): DEFINES = -DTCC_TARGET_I386
196 $(X64_CROSS) $($(X64_CROSS)_LINK): DEFINES = -DTCC_TARGET_X86_64
197 $(WIN32_CROSS) $($(WIN32_CROSS)_LINK): DEFINES = -DTCC_TARGET_I386 -DTCC_TARGET_PE \
198 -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
199 -DCONFIG_TCC_LIBPATHS="\"{B}/lib/32;{B}/lib\""
200 $(WIN64_CROSS) $($(WIN64_CROSS)_LINK): DEFINES = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE \
201 -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
202 -DCONFIG_TCC_LIBPATHS="\"{B}/lib/64;{B}/lib\""
203 $(WINCE_CROSS): DEFINES = -DTCC_TARGET_PE
204 $(C67_CROSS): DEFINES = -DTCC_TARGET_C67
205 $(ARM_FPA_CROSS): DEFINES = -DTCC_TARGET_ARM
206 $(ARM_FPA_LD_CROSS)$(EXESUF): DEFINES = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
207 $(ARM_VFP_CROSS): DEFINES = -DTCC_TARGET_ARM -DTCC_ARM_VFP
208 $(ARM_EABI_CROSS): DEFINES = -DTCC_TARGET_ARM -DTCC_ARM_EABI -DTCC_ARM_VFP
209 $(ARM64_CROSS): DEFINES = -DTCC_TARGET_ARM64
211 $(I386_CROSS) $($(I386_CROSS)_LINK): $(I386_FILES)
212 $(X64_CROSS) $($(X64_CROSS)_LINK): $(X86_64_FILES)
213 $(WIN32_CROSS) $($(WIN32_CROSS)_LINK): $(WIN32_FILES)
214 $(WIN64_CROSS) $($(WIN64_CROSS)_LINK): $(WIN64_FILES)
215 $(WINCE_CROSS) $($(WINCE_CROSS)_LINK): $(WINCE_FILES)
216 $(C67_CROSS) $($(C67_CROSS)_LINK): $(C67_FILES)
217 $(ARM_FPA_CROSS) $(ARM_FPA_LD_CROSS) $(ARM_VFP_CROSS) $(ARM_EABI_CROSS): $(ARM_FILES)
218 $($(ARM_FPA_CROSS)_LINK) $($(ARM_FPA_LD_CROSS)_LINK) $($(ARM_VFP_CROSS)_LINK) $($(ARM_EABI_CROSS)_LINK): $(ARM_FILES)
219 $(ARM64_CROSS): $(ARM64_FILES)
221 # libtcc generation and test
222 ifndef ONE_SOURCE
223 LIBTCC_OBJ = $(filter-out tcc.o,$(patsubst %.c,%.o,$(filter %.c,$(NATIVE_FILES))))
224 LIBTCC_INC = $(filter %.h,$(CORE_FILES)) $(filter-out $(CORE_FILES),$(NATIVE_FILES))
225 else
226 LIBTCC_OBJ = libtcc.o
227 LIBTCC_INC = $(NATIVE_FILES)
228 libtcc.o : NATIVE_DEFINES += -DONE_SOURCE
229 endif
231 $(LIBTCC_OBJ) tcc.o : %.o : %.c $(LIBTCC_INC)
232 $(CC) -o $@ -c $< $(NATIVE_DEFINES) $(CPPFLAGS) $(CFLAGS)
234 ifndef LIBTCC_DLL
235 libtcc.a: $(LIBTCC_OBJ)
236 $(AR) rcs $@ $^
237 endif
239 libtcc.so.1.0: $(LIBTCC_OBJ)
240 $(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
242 libtcc.so.1.0: CFLAGS+=-fPIC
244 ifdef LIBTCC_DLL
245 libtcc.dll libtcc.def libtcc.a: $(LIBTCC_OBJ)
246 $(CC) -shared $^ -o $@ $(LDFLAGS) -Wl,--output-def,libtcc.def,--out-implib,libtcc.a
247 endif
249 # windows utilities
250 tiny_impdef$(EXESUF): win32/tools/tiny_impdef.c
251 $(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
252 tiny_libmaker$(EXESUF): win32/tools/tiny_libmaker.c
253 $(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
255 # TinyCC runtime libraries
256 libtcc1.a : FORCE $(PROGS)
257 $(MAKE) -C lib native
258 if test ! -d $(ARCH); then mkdir $(ARCH); fi
259 if test ! -L $(ARCH)/$@; then ln -sf ../$@ $(ARCH)/$@; fi
260 lib/%/libtcc1.a : FORCE $(PROGS_CROSS)
261 $(MAKE) -C lib cross TARGET=$*
263 FORCE:
265 # install
266 TCC_INCLUDES = stdarg.h stddef.h stdbool.h float.h varargs.h
267 INSTALL=install
268 ifdef STRIP_BINARIES
269 INSTALLBIN=$(INSTALL) -s
270 else
271 INSTALLBIN=$(INSTALL)
272 endif
274 ifdef CONFIG_WIN32
275 CONFIG_WIN=yes
276 endif
277 ifdef CONFIG_WIN64
278 CONFIG_WIN=yes
279 endif
281 install-strip: install
282 strip $(foreach PROG,$(PROGS),"$(bindir)"/$(PROG))
284 ifndef CONFIG_WIN
285 install: $(PROGS) $(TCCLIBS) $(TCCDOCS)
286 mkdir -p "$(bindir)"
287 $(INSTALLBIN) -m755 $(PROGS) "$(bindir)"
288 cp -P tcc$(EXESUF) "$(bindir)"
289 mkdir -p "$(mandir)/man1"
290 -$(INSTALL) -m644 tcc.1 "$(mandir)/man1"
291 mkdir -p "$(infodir)"
292 -$(INSTALL) -m644 tcc-doc.info "$(infodir)"
293 mkdir -p "$(tccdir)"
294 mkdir -p "$(tccdir)/include"
295 ifneq ($(LIBTCC1),)
296 mkdir -p "$(tccdir)/$(ARCH)"
297 $(INSTALL) -m644 $(LIBTCC1) "$(tccdir)/$(ARCH)"
298 endif
299 $(INSTALL) -m644 $(addprefix $(top_srcdir)/include/,$(TCC_INCLUDES)) $(top_srcdir)/tcclib.h "$(tccdir)/include"
300 mkdir -p "$(libdir)"
301 $(INSTALL) -m644 $(LIBTCC) "$(libdir)"
302 ifdef DISABLE_STATIC
303 ln -sf "$(ln_libdir)/libtcc.so.1.0" "$(libdir)/libtcc.so.1"
304 ln -sf "$(ln_libdir)/libtcc.so.1.0" "$(libdir)/libtcc.so"
305 endif
306 mkdir -p "$(includedir)"
307 $(INSTALL) -m644 $(top_srcdir)/libtcc.h "$(includedir)"
308 mkdir -p "$(docdir)"
309 -$(INSTALL) -m644 tcc-doc.html "$(docdir)"
310 ifdef CONFIG_CROSS
311 mkdir -p "$(tccdir)/win32/lib/32"
312 mkdir -p "$(tccdir)/win32/lib/64"
313 mkdir -p "$(tccdir)/i386"
314 mkdir -p "$(tccdir)/x86-64"
315 ifneq ($(HOST_OS),Darwin)
316 mkdir -p "$(tccdir)/arm64"
317 $(INSTALL) -m644 lib/arm64/libtcc1.a "$(tccdir)/arm64"
318 endif
319 $(INSTALL) -m644 lib/i386/libtcc1.a "$(tccdir)/i386"
320 $(INSTALL) -m644 lib/x86_64/libtcc1.a "$(tccdir)/x86-64"
321 $(INSTALL) -m644 $(top_srcdir)/win32/lib/*.def "$(tccdir)/win32/lib"
322 $(INSTALL) -m644 lib/i386-win/libtcc1.a "$(tccdir)/win32/lib/32"
323 $(INSTALL) -m644 lib/x86_64-win/libtcc1.a "$(tccdir)/win32/lib/64"
324 cp -r $(top_srcdir)/win32/include/. "$(tccdir)/win32/include"
325 cp -r "$(tccdir)/include" "$(tccdir)/win32"
326 endif
328 uninstall:
329 rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
330 rm -fv "$(bindir)/tcc$(EXESUF)"
331 rm -fv $(foreach P,$(LIBTCC1),"$(tccdir)/$P")
332 rm -fv $(foreach P,$(TCC_INCLUDES),"$(tccdir)/include/$P")
333 rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info"
334 rm -fv "$(libdir)/$(LIBTCC)" "$(includedir)/libtcc.h"
335 rm -fv "$(libdir)/libtcc.so*"
336 rm -rv "$(tccdir)"
337 rm -rv "$(docdir)"
338 else
339 # on windows
340 install: $(PROGS) $(TCCLIBS) $(TCCDOCS)
341 mkdir -p "$(tccdir)"
342 mkdir -p "$(tccdir)/lib"
343 mkdir -p "$(tccdir)/include"
344 mkdir -p "$(tccdir)/examples"
345 mkdir -p "$(tccdir)/doc"
346 mkdir -p "$(tccdir)/libtcc"
347 $(INSTALLBIN) -m755 $(PROGS) "$(tccdir)"
348 $(INSTALLBIN) -m755 tcc.exe "$(tccdir)"
349 $(INSTALL) -m644 $(LIBTCC1) $(top_srcdir)/win32/lib/*.def "$(tccdir)/lib"
350 cp -r $(top_srcdir)/win32/include/. "$(tccdir)/include"
351 cp -r $(top_srcdir)/win32/examples/. "$(tccdir)/examples"
352 $(INSTALL) -m644 $(addprefix $(top_srcdir)/include/,$(TCC_INCLUDES)) $(top_srcdir)/tcclib.h "$(tccdir)/include"
353 $(INSTALL) -m644 tcc-doc.html $(top_srcdir)/win32/tcc-win32.txt "$(tccdir)/doc"
354 $(INSTALL) -m644 $(top_srcdir)/libtcc.h $(LIBTCC_EXTRA) "$(tccdir)/libtcc"
355 $(INSTALL) -m644 $(LIBTCC) "$(tccdir)"
356 ifdef CONFIG_CROSS
357 mkdir -p "$(tccdir)/lib/32"
358 mkdir -p "$(tccdir)/lib/64"
359 -$(INSTALL) -m644 lib/i386-win/libtcc1.a "$(tccdir)/lib/32"
360 -$(INSTALL) -m644 lib/x86_64-win/libtcc1.a "$(tccdir)/lib/64"
361 endif
363 uninstall:
364 rm -rfv "$(tccdir)/*"
365 endif
367 # documentation and man page
368 tcc-doc.html: tcc-doc.texi
369 -makeinfo --no-split --html --number-sections -o $@ $<
371 tcc.1: tcc-doc.texi
372 -$(top_srcdir)/texi2pod.pl $< tcc.pod
373 -pod2man --section=1 --center="Tiny C Compiler" --release=`cat $(top_srcdir)/VERSION` tcc.pod > $@
375 tcc-doc.info: tcc-doc.texi
376 -makeinfo $<
378 # in tests subdir
379 export LIBTCC1
381 %est:
382 $(MAKE) -C tests $@ 'PROGS_CROSS=$(PROGS_CROSS)'
384 clean:
385 rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.log \
386 *.exe a.out tags TAGS libtcc_test$(EXESUF) tcc$(EXESUF)
387 -rm -r $(ARCH) arm64
388 ifeq ($(HOST_OS),Linux)
389 -rm -r ./C:
390 endif
391 -rm *-tcc$(EXESUF)
392 $(MAKE) -C tests $@
393 ifneq ($(LIBTCC1),)
394 $(MAKE) -C lib $@
395 endif
397 distclean: clean
398 rm -vf config.h config.mak config.texi tcc.1 tcc-doc.info tcc-doc.html
400 config.mak:
401 @echo "Please run ./configure."
402 @exit 1
404 tags:
405 ctags $(top_srcdir)/*.[ch] $(top_srcdir)/include/*.h $(top_srcdir)/lib/*.[chS]
407 TAGS:
408 ctags -e $(top_srcdir)/*.[ch] $(top_srcdir)/include/*.h $(top_srcdir)/lib/*.[chS]
410 # create release tarball from *current* git branch (including tcc-doc.html
411 # and converting two files to CRLF)
412 TCC-VERSION := tcc-$(shell cat $(top_srcdir)/VERSION)
413 tar: tcc-doc.html
414 mkdir $(TCC-VERSION)
415 ( cd $(TCC-VERSION) && git --git-dir ../.git checkout -f )
416 cp tcc-doc.html $(TCC-VERSION)
417 for f in tcc-win32.txt build-tcc.bat ; do \
418 cat win32/$$f | sed 's,\(.*\),\1\r,g' > $(TCC-VERSION)/win32/$$f ; \
419 done
420 tar cjf $(TCC-VERSION).tar.bz2 $(TCC-VERSION)
421 rm -rf $(TCC-VERSION)
422 git reset
424 .PHONY: all clean tar tags TAGS distclean install uninstall FORCE
426 endif # ifeq ($(TOP),.)