1 # --------------------------------------------------------------------------
3 # Tiny C Compiler Makefile
11 ifeq ($(findstring $(MAKECMDGOALS
),clean distclean),)
12 include $(TOP
)/config.mak
15 ifeq (-$(GCC_MAJOR
)-$(findstring $(GCC_MINOR
),56789)-,-4--)
16 CFLAGS
+= -D_FORTIFY_SOURCE
=0
29 ifneq ($(CONFIG_static
),yes
)
30 LIBTCC
= libtcc
$(DLLSUF
)
31 LIBTCCDEF
= libtcc.def
33 NATIVE_TARGET
= $(ARCH
)-win
$(if
$(findstring arm
,$(ARCH
)),ce
,32)
37 ifneq ($(CONFIG_ldl
),no
)
40 # make libtcc as static or dynamic library?
41 ifeq ($(CONFIG_static
),no
)
42 LIBTCC
=libtcc
$(DLLSUF
)
43 export LD_LIBRARY_PATH
:= $(CURDIR
)/$(TOP
)
44 ifneq ($(CONFIG_rpath
),no
)
46 LINK_LIBTCC
+= -Wl
,-rpath
,"$(libdir)"
48 # macOS doesn't support env-vars libdir out of the box - which we need for
49 # `make test' when libtcc.dylib is used (configure --disable-static), so
50 # we bake a relative path into the binary. $libdir is used after install.
51 LINK_LIBTCC
+= -Wl
,-rpath
,"@executable_path/$(TOP)" -Wl
,-rpath
,"$(libdir)"
52 DYLIBVER
+= -current_version
$(VERSION
)
53 DYLIBVER
+= -compatibility_version
$(VERSION
)
57 NATIVE_TARGET
= $(ARCH
)
59 NATIVE_TARGET
= $(ARCH
)-osx
60 ifneq ($(CC_NAME
),tcc
)
61 LDFLAGS
+= -flat_namespace
-undefined warning
63 export MACOSX_DEPLOYMENT_TARGET
:= 10.6
67 # run local version of tcc with local libraries and includes
68 TCCFLAGS-unx
= -B
$(TOP
) -I
$(TOPSRC
)/include -I
$(TOPSRC
) -I
$(TOP
)
69 TCCFLAGS-win
= -B
$(TOPSRC
)/win32
-I
$(TOPSRC
)/include -I
$(TOPSRC
) -I
$(TOP
) -L
$(TOP
)
70 TCCFLAGS
= $(TCCFLAGS
$(CFG
))
71 TCC
= $(TOP
)/tcc
$(EXESUF
) $(TCCFLAGS
)
73 CFLAGS_P
= $(CFLAGS
) -pg
-static
-DCONFIG_TCC_STATIC
-DTCC_PROFILE
75 LDFLAGS_P
= $(LDFLAGS
)
78 NATIVE_DEFINES_
$(CONFIG_i386
) += -DTCC_TARGET_I386
79 NATIVE_DEFINES_
$(CONFIG_x86_64
) += -DTCC_TARGET_X86_64
80 NATIVE_DEFINES_
$(CONFIG_WIN32
) += -DTCC_TARGET_PE
81 NATIVE_DEFINES_
$(CONFIG_OSX
) += -DTCC_TARGET_MACHO
82 NATIVE_DEFINES_
$(CONFIG_uClibc
) += -DTCC_UCLIBC
83 NATIVE_DEFINES_
$(CONFIG_musl
) += -DTCC_MUSL
84 NATIVE_DEFINES_
$(CONFIG_libgcc
) += -DCONFIG_USE_LIBGCC
85 NATIVE_DEFINES_
$(CONFIG_selinux
) += -DHAVE_SELINUX
86 NATIVE_DEFINES_
$(CONFIG_arm
) += -DTCC_TARGET_ARM
87 NATIVE_DEFINES_
$(CONFIG_arm_eabihf
) += -DTCC_ARM_EABI
-DTCC_ARM_HARDFLOAT
88 NATIVE_DEFINES_
$(CONFIG_arm_eabi
) += -DTCC_ARM_EABI
89 NATIVE_DEFINES_
$(CONFIG_arm_vfp
) += -DTCC_ARM_VFP
90 NATIVE_DEFINES_
$(CONFIG_arm64
) += -DTCC_TARGET_ARM64
91 NATIVE_DEFINES_
$(CONFIG_riscv64
) += -DTCC_TARGET_RISCV64
92 NATIVE_DEFINES_
$(CONFIG_BSD
) += -DTARGETOS_
$(TARGETOS
)
93 NATIVE_DEFINES_
$(CONFIG_Android
) += -DTARGETOS_ANDROID
94 NATIVE_DEFINES_
$(CONFIG_pie
) += -DCONFIG_TCC_PIE
95 NATIVE_DEFINES_
$(CONFIG_pic
) += -DCONFIG_TCC_PIC
96 NATIVE_DEFINES_
$(CONFIG_new_macho
) += -DCONFIG_NEW_MACHO
97 NATIVE_DEFINES_
$(CONFIG_codesign
) += -DCONFIG_CODESIGN
98 NATIVE_DEFINES_
$(CONFIG_new-dtags
) += -DCONFIG_NEW_DTAGS
99 NATIVE_DEFINES_no_
$(CONFIG_bcheck
) += -DCONFIG_TCC_BCHECK
=0
100 NATIVE_DEFINES_no_
$(CONFIG_backtrace
) += -DCONFIG_TCC_BACKTRACE
=0
101 NATIVE_DEFINES
+= $(NATIVE_DEFINES_yes
) $(NATIVE_DEFINES_no_no
)
103 DEF-i386
= -DTCC_TARGET_I386
104 DEF-i386-win32
= -DTCC_TARGET_I386
-DTCC_TARGET_PE
105 DEF-i386-OpenBSD
= $(DEF-i386
) -DTARGETOS_OpenBSD
106 DEF-x86_64
= -DTCC_TARGET_X86_64
107 DEF-x86_64-win32
= -DTCC_TARGET_X86_64
-DTCC_TARGET_PE
108 DEF-x86_64-osx
= -DTCC_TARGET_X86_64
-DTCC_TARGET_MACHO
109 DEF-arm-fpa
= -DTCC_TARGET_ARM
110 DEF-arm-fpa-ld
= -DTCC_TARGET_ARM
-DLDOUBLE_SIZE
=12
111 DEF-arm-vfp
= -DTCC_TARGET_ARM
-DTCC_ARM_VFP
112 DEF-arm-eabi
= -DTCC_TARGET_ARM
-DTCC_ARM_VFP
-DTCC_ARM_EABI
113 DEF-arm-eabihf
= $(DEF-arm-eabi
) -DTCC_ARM_HARDFLOAT
114 DEF-arm
= $(DEF-arm-eabihf
)
115 DEF-arm-NetBSD
= $(DEF-arm-eabihf
) -DTARGETOS_NetBSD
116 DEF-arm-wince
= $(DEF-arm-eabihf
) -DTCC_TARGET_PE
117 DEF-arm64
= -DTCC_TARGET_ARM64
118 DEF-arm64-osx
= $(DEF-arm64
) -DTCC_TARGET_MACHO
119 DEF-arm64-FreeBSD
= $(DEF-arm64
) -DTARGETOS_FreeBSD
120 DEF-arm64-NetBSD
= $(DEF-arm64
) -DTARGETOS_NetBSD
121 DEF-arm64-OpenBSD
= $(DEF-arm64
) -DTARGETOS_OpenBSD
122 DEF-riscv64
= -DTCC_TARGET_RISCV64
123 DEF-c67
= -DTCC_TARGET_C67
-w
# disable warnigs
124 DEF-x86_64-FreeBSD
= $(DEF-x86_64
) -DTARGETOS_FreeBSD
125 DEF-x86_64-NetBSD
= $(DEF-x86_64
) -DTARGETOS_NetBSD
126 DEF-x86_64-OpenBSD
= $(DEF-x86_64
) -DTARGETOS_OpenBSD
128 DEF-
$(NATIVE_TARGET
) = $(NATIVE_DEFINES
)
130 ifeq ($(INCLUDED
),no
)
131 # --------------------------------------------------------------------------
132 # running top Makefile
135 TCCLIBS
= $(LIBTCCDEF
) $(LIBTCC
) $(LIBTCC1
)
136 TCCDOCS
= tcc
.1 tcc-doc.html tcc-doc.
info
138 all: $(PROGS
) $(TCCLIBS
) $(TCCDOCS
)
140 # cross compiler targets to build
141 TCC_X
= i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
142 TCC_X
+= riscv64 arm64-osx
143 # TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
145 # cross libtcc1.a targets to build
146 LIBTCC1_X
= i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince
147 LIBTCC1_X
+= riscv64 arm64-osx
149 PROGS_CROSS
= $(foreach X
,$(TCC_X
),$X-tcc
$(EXESUF
))
150 LIBTCC1_CROSS
= $(foreach X
,$(LIBTCC1_X
),$X-libtcc
1.a
)
152 # build cross compilers & libs
153 cross
: $(LIBTCC1_CROSS
) $(PROGS_CROSS
)
155 # build specific cross compiler & lib
156 cross-
%: %-tcc
$(EXESUF
) %-libtcc1.a
;
158 install: ; @
$(MAKE
) --no-print-directory
install$(CFG
)
159 install-strip
: ; @
$(MAKE
) --no-print-directory
install$(CFG
) CONFIG_strip
=yes
160 uninstall: ; @
$(MAKE
) --no-print-directory
uninstall$(CFG
)
166 # --------------------------------------------
168 T
= $(or
$(CROSS_TARGET
),$(NATIVE_TARGET
),unknown
)
169 X
= $(if
$(CROSS_TARGET
),$(CROSS_TARGET
)-)
171 DEFINES
+= $(DEF-
$T) $(DEF-all
)
172 DEFINES
+= $(if
$(ROOT-
$T),-DCONFIG_SYSROOT
="\"$(ROOT-$T)\"")
173 DEFINES
+= $(if
$(CRT-
$T),-DCONFIG_TCC_CRTPREFIX
="\"$(CRT-$T)\"")
174 DEFINES
+= $(if
$(LIB-
$T),-DCONFIG_TCC_LIBPATHS
="\"$(LIB-$T)\"")
175 DEFINES
+= $(if
$(INC-
$T),-DCONFIG_TCC_SYSINCLUDEPATHS
="\"$(INC-$T)\"")
176 DEFINES
+= $(if
$(ELF-
$T),-DCONFIG_TCC_ELFINTERP
="\"$(ELF-$T)\"")
177 DEFINES
+= $(DEF-
$(or
$(findstring win
,$T),unx
))
180 ifeq ($(CONFIG_WIN32
),yes
)
181 DEF-win
+= -DCONFIG_TCC_CROSSPREFIX
="\"$X\""
182 DEF-unx
+= -DCONFIG_TCC_CROSSPREFIX
="\"lib/$X\""
184 DEF-all
+= -DCONFIG_TCC_CROSSPREFIX
="\"$X\""
185 DEF-win
+= -DCONFIG_TCCDIR
="\"$(tccdir)/win32\""
189 # include custom configuration (see make help)
190 -include config-extra.mak
193 # assume support files for cross-targets in "/usr/<triplet>" by default
194 TRIPLET-i386 ?
= i386-linux-gnu
195 TRIPLET-x86_64 ?
= x86_64-linux-gnu
196 TRIPLET-arm ?
= arm-linux-gnueabihf
197 TRIPLET-arm64 ?
= aarch64-linux-gnu
198 TRIPLET-riscv64 ?
= riscv64-linux-gnu
199 TR
= $(if
$(TRIPLET-
$T),$T,ignored
)
200 CRT-
$(TR
) ?
= /usr
/$(TRIPLET-
$T)/lib
201 LIB-
$(TR
) ?
= {B
}:/usr
/$(TRIPLET-
$T)/lib
202 INC-
$(TR
) ?
= {B
}/include:/usr
/$(TRIPLET-
$T)/include
205 CORE_FILES
= tcc.c tcctools.c libtcc.c tccpp.c tccgen.c tccdbg.c tccelf.c tccasm.c tccrun.c
206 CORE_FILES
+= tcc.h config.h libtcc.h tcctok.h
207 i386_FILES
= $(CORE_FILES
) i386-gen.c i386-link.c i386-asm.c i386-asm.h i386-tok.h
208 i386-win32_FILES
= $(i386_FILES
) tccpe.c
209 x86_64_FILES
= $(CORE_FILES
) x86_64-gen.c x86_64-link.c i386-asm.c x86_64-asm.h
210 x86_64-win32_FILES
= $(x86_64_FILES
) tccpe.c
211 x86_64-osx_FILES
= $(x86_64_FILES
) tccmacho.c
212 arm_FILES
= $(CORE_FILES
) arm-gen.c arm-link.c arm-asm.c arm-tok.h
213 arm-wince_FILES
= $(arm_FILES
) tccpe.c
214 arm-eabihf_FILES
= $(arm_FILES
)
215 arm-fpa_FILES
= $(arm_FILES
)
216 arm-fpa-ld_FILES
= $(arm_FILES
)
217 arm-vfp_FILES
= $(arm_FILES
)
218 arm-eabi_FILES
= $(arm_FILES
)
219 arm-eabihf_FILES
= $(arm_FILES
)
220 arm64_FILES
= $(CORE_FILES
) arm64-gen.c arm64-link.c arm64-asm.c
221 arm64-osx_FILES
= $(arm64_FILES
) tccmacho.c
222 c67_FILES
= $(CORE_FILES
) c67-gen.c c67-link.c tcccoff.c
223 riscv64_FILES
= $(CORE_FILES
) riscv64-gen.c riscv64-link.c riscv64-asm.c
225 TCCDEFS_H
$(subst yes
,,$(CONFIG_predefs
)) = tccdefs_.h
228 LIBTCC_SRC
= $(filter-out tcc.c tcctools.c
,$(filter %.c
,$($T_FILES)))
230 ifeq ($(ONE_SOURCE
),yes
)
231 LIBTCC_OBJ
= $(X
)libtcc.o
232 LIBTCC_INC
= $($T_FILES)
233 TCC_FILES
= $(X
)tcc.o
234 tcc.o
: DEFINES
+= -DONE_SOURCE
=0
235 $(X
)tcc.o
$(X
)libtcc.o
: $(TCCDEFS_H
)
237 LIBTCC_OBJ
= $(patsubst %.c
,$(X
)%.o
,$(LIBTCC_SRC
))
238 LIBTCC_INC
= $(filter %.h
%-gen.c
%-link.c
,$($T_FILES))
239 TCC_FILES
= $(X
)tcc.o
$(LIBTCC_OBJ
)
240 $(TCC_FILES
) : DEFINES
+= -DONE_SOURCE
=0
241 $(X
)tccpp.o
: $(TCCDEFS_H
)
244 GITHASH
:= $(shell git rev-parse
>/dev
/null
2>&1 && git rev-parse
--short HEAD || echo no
)
245 ifneq ($(GITHASH
),no
)
246 DEF_GITHASH
:= -DTCC_GITHASH
="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
249 ifeq ($(CONFIG_debug
),yes
)
258 # convert "include/tccdefs.h" to "tccdefs_.h"
259 %_.h
: include/%.h conftest.c
260 $S$(CC
) -DC2STR
$(filter %.c
,$^
) -o c2str.exe
&& .
/c2str.exe
$< $@
262 # target specific object rule
263 $(X
)%.o
: %.c
$(LIBTCC_INC
)
264 $S$(CC
) -o
$@
-c
$< $(DEFINES
) $(CFLAGS
)
266 # additional dependencies
267 $(X
)tcc.o
: tcctools.c
268 $(X
)tcc.o
: DEFINES
+= $(DEF_GITHASH
)
270 # Host Tiny C Compiler
271 tcc
$(EXESUF
): tcc.o
$(LIBTCC
)
272 $S$(CC
) -o
$@
$^
$(LIBS
) $(LDFLAGS
) $(LINK_LIBTCC
)
274 # Cross Tiny C Compilers
275 # (the TCCDEFS_H dependency is only necessary for parallel makes,
276 # ala 'make -j x86_64-tcc i386-tcc tcc', which would create multiple
277 # c2str.exe and tccdefs_.h files in parallel, leading to access errors.
278 # This forces it to be made only once. Make normally tracks multiple paths
279 # to the same goals and only remakes it once, but that doesn't work over
280 # sub-makes like in this target)
281 %-tcc
$(EXESUF
): $(TCCDEFS_H
) FORCE
282 @
$(MAKE
) --no-print-directory
$@ CROSS_TARGET
=$* ONE_SOURCE
=$(or
$(ONE_SOURCE
),yes
)
284 $(CROSS_TARGET
)-tcc
$(EXESUF
): $(TCC_FILES
)
285 $S$(CC
) -o
$@
$^
$(LIBS
) $(LDFLAGS
)
288 tcc_p
$(EXESUF
): $($T_FILES)
289 $S$(CC
) -o
$@
$< $(DEFINES
) $(CFLAGS_P
) $(LIBS_P
) $(LDFLAGS_P
)
291 # static libtcc library
292 libtcc.a
: $(LIBTCC_OBJ
)
295 # dynamic libtcc library
296 libtcc.so
: $(LIBTCC_OBJ
)
297 $S$(CC
) -shared
-Wl
,-soname
,$@
-o
$@
$^
$(LIBS
) $(LDFLAGS
)
299 libtcc.so
: CFLAGS
+=-fPIC
300 libtcc.so
: LDFLAGS
+=-fPIC
302 # OSX dynamic libtcc library
303 libtcc.dylib
: $(LIBTCC_OBJ
)
304 $S$(CC
) -dynamiclib
$(DYLIBVER
) -install_name @rpath
/$@
-o
$@
$^
$(LDFLAGS
)
306 # OSX libtcc.dylib (without rpath/ prefix)
307 libtcc.osx
: $(LIBTCC_OBJ
)
308 $S$(CC
) -shared
-install_name libtcc.dylib
-o libtcc.dylib
$^
$(LDFLAGS
)
310 # windows dynamic libtcc library
311 libtcc.dll
: $(LIBTCC_OBJ
)
312 $S$(CC
) -shared
-o
$@
$^
$(LDFLAGS
)
313 libtcc.dll
: DEFINES
+= -DLIBTCC_AS_DLL
315 # import file for windows libtcc.dll
316 libtcc.def
: libtcc.dll tcc
$(EXESUF
)
317 $S$(XTCC
) -impdef
$< -o
$@
318 XTCC ?
= .
/tcc
$(EXESUF
)
320 # TinyCC runtime libraries
321 libtcc1.a
: tcc
$(EXESUF
) FORCE
325 %-libtcc1.a
: %-tcc
$(EXESUF
) FORCE
326 @
$(MAKE
) -C lib CROSS_TARGET
=$*
328 .PRECIOUS
: %-libtcc1.a
331 run-if
= $(if
$(shell which
$1),$S $1 $2)
332 S
= $(if
$(findstring yes
,$(SILENT
)),@
$(info * $@
))
334 # --------------------------------------------------------------------------
335 # documentation and man page
336 tcc-doc.html
: tcc-doc.texi
337 $(call run-if
,makeinfo,--no-split
--html
--number-sections
-o
$@
$<)
339 tcc-doc.
info: tcc-doc.texi
340 $(call run-if
,makeinfo,$< || true
)
343 $(call run-if
,pod2man
,--section
=1 --center
="Tiny C Compiler" \
344 --release
="$(VERSION)" $< >$@
&& rm -f
$<)
346 $(call run-if
,perl
,$(TOPSRC
)/texi2pod.pl
$< $@
)
350 # --------------------------------------------------------------------------
353 INSTALL
= install -m644
354 INSTALLBIN
= install -m755
$(STRIP_
$(CONFIG_strip
))
357 LIBTCC1_W
= $(filter %-win32-libtcc1.a
%-wince-libtcc1.a
,$(LIBTCC1_CROSS
))
358 LIBTCC1_U
= $(filter-out $(LIBTCC1_W
),$(wildcard *-libtcc1.a
))
359 IB
= $(if
$1,$(IM
) mkdir
-p
$2 && $(INSTALLBIN
) $1 $2)
360 IBw
= $(call IB
,$(wildcard $1),$2)
361 IF
= $(if
$1,$(IM
) mkdir
-p
$2 && $(INSTALL
) $1 $2)
362 IFw
= $(call IF
,$(wildcard $1),$2)
363 IR
= $(IM
) mkdir
-p
$2 && cp
-r
$1/.
$2
364 IM
= $(info -> $2 : $1)@
366 B_O
= bcheck.o bt-exe.o bt-log.o bt-dll.o
368 # install progs & libs
370 $(call IBw
,$(PROGS
) *-tcc
,"$(bindir)")
371 $(call IFw
,$(LIBTCC1
) $(B_O
) $(LIBTCC1_U
),"$(tccdir)")
372 $(call IF
,$(TOPSRC
)/include/*.h
$(TOPSRC
)/tcclib.h
,"$(tccdir)/include")
373 $(call
$(if
$(findstring .so
,$(LIBTCC
)),IBw
,IFw
),$(LIBTCC
),"$(libdir)")
374 $(call IF
,$(TOPSRC
)/libtcc.h
,"$(includedir)")
375 $(call IFw
,tcc
.1,"$(mandir)/man1")
376 $(call IFw
,tcc-doc.
info,"$(infodir)")
377 $(call IFw
,tcc-doc.html
,"$(docdir)")
378 ifneq "$(wildcard $(LIBTCC1_W))" ""
379 $(call IFw
,$(TOPSRC
)/win32
/lib
/*.def
$(LIBTCC1_W
),"$(tccdir)/win32/lib")
380 $(call IR
,$(TOPSRC
)/win32
/include,"$(tccdir)/win32/include")
381 $(call IF
,$(TOPSRC
)/include/*.h
$(TOPSRC
)/tcclib.h
,"$(tccdir)/win32/include")
386 @
rm -fv
$(foreach P
,$(PROGS
) $(PROGS_CROSS
),"$(bindir)/$P")
387 @
rm -fv
"$(libdir)/libtcc.a" "$(libdir)/libtcc.so" "$(libdir)/libtcc.dylib" "$(includedir)/libtcc.h"
388 @
rm -fv
"$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info"
389 @
rm -fv
"$(docdir)/tcc-doc.html"
392 # install progs & libs on windows
394 $(call IBw
,$(PROGS
) $(PROGS_CROSS
) $(subst libtcc.a
,,$(LIBTCC
)),"$(bindir)")
395 $(call IF
,$(TOPSRC
)/win32
/lib
/*.def
,"$(tccdir)/lib")
396 $(call IFw
,libtcc1.a
$(B_O
) $(LIBTCC1_W
),"$(tccdir)/lib")
397 $(call IF
,$(TOPSRC
)/include/*.h
$(TOPSRC
)/tcclib.h
,"$(tccdir)/include")
398 $(call IR
,$(TOPSRC
)/win32
/include,"$(tccdir)/include")
399 $(call IR
,$(TOPSRC
)/win32
/examples
,"$(tccdir)/examples")
400 $(call IF
,$(TOPSRC
)/tests
/libtcc_test.c
,"$(tccdir)/examples")
401 $(call IFw
,$(TOPSRC
)/libtcc.h
$(subst .dll
,.def
,$(LIBTCC
)),"$(libdir)")
402 $(call IFw
,$(TOPSRC
)/win32
/tcc-win32.txt tcc-doc.html
,"$(docdir)")
403 ifneq "$(wildcard $(LIBTCC1_U))" ""
404 $(call IFw
,$(LIBTCC1_U
),"$(tccdir)/lib")
405 $(call IF
,$(TOPSRC
)/include/*.h
$(TOPSRC
)/tcclib.h
,"$(tccdir)/lib/include")
408 # the msys-git shell works to configure && make except it does not have install
409 ifeq ($(CONFIG_WIN32
)-$(shell which
install || echo no
),yes-no
)
410 install-win
: INSTALL
= cp
411 install-win
: INSTALLBIN
= cp
414 # uninstall on windows
416 @
rm -fv
$(foreach P
,libtcc.dll
$(PROGS
) *-tcc.exe
,"$(bindir)"/$P)
417 @
rm -fr
$(foreach P
,doc examples
include lib libtcc
,"$(tccdir)/$P"/*)
418 @
rm -frv
$(foreach P
,doc examples
include lib libtcc
,"$(tccdir)/$P")
420 # --------------------------------------------------------------------------
423 TAGFILES
= *.
[ch
] include/*.h lib
/*.
[chS
]
424 tags : ; ctags
$(TAGFILES
)
425 # cannot have both tags and TAGS on windows
426 ETAGS
: ; etags
$(TAGFILES
)
428 # create release tarball from *current* git branch (including tcc-doc.html
429 # and converting two files to CRLF)
430 TCC-VERSION
= tcc-
$(VERSION
)
431 TCC-VERSION
= tinycc-mob-
$(shell git rev-parse
--short
=7 HEAD
)
433 mkdir
-p
$(TCC-VERSION
)
434 ( cd
$(TCC-VERSION
) && git
--git-dir ..
/.git checkout
-f
)
435 cp tcc-doc.html
$(TCC-VERSION
)
436 for f in tcc-win32.txt build-tcc.bat
; do \
437 cat win32
/$$f | sed
's,\(.*\),\1\r,g' > $(TCC-VERSION
)/win32
/$$f ; \
439 tar cjf
$(TCC-VERSION
).
tar.bz2
$(TCC-VERSION
)
440 rm -rf
$(TCC-VERSION
)
444 $(if
$(wildcard $@
),,@echo
"Please run ./configure." && exit
1)
449 # run test(s) from tests2 subdir (see make help)
451 @
$(MAKE
) -C tests
/tests2
$@
454 @
$(MAKE
) -C tests
/pp
$@
457 @
rm -f tcc
$(EXESUF
) tcc_p
$(EXESUF
) *-tcc
$(EXESUF
) tags ETAGS
*.pod
458 @
rm -f
*.o
*.a
*.so
* *.out
*.log lib
*.def
*.exe
*.dll a.out
*.dylib
*_.h
459 @
$(MAKE
) -s
-C lib
$@
460 @
$(MAKE
) -s
-C tests
$@
463 @
rm -fv config.h config.mak config.texi
466 .PHONY
: all clean test tar tags ETAGS doc
distclean install uninstall FORCE
470 @echo
" build native compiler (from separate objects)"
473 @echo
" build cross compilers (from one source)"
475 @echo
"make ONE_SOURCE=no/yes SILENT=no/yes"
476 @echo
" force building from separate/one object(s), less/more silently"
478 @echo
"make cross-TARGET"
479 @echo
" build one specific cross compiler for 'TARGET'. Currently supported:"
480 @echo
" $(wordlist 1,6,$(TCC_X))"
481 @echo
" $(wordlist 7,99,$(TCC_X))"
484 @echo
" run all tests"
486 @echo
"make tests2.all / make tests2.37 / make tests2.37+"
487 @echo
" run all/single test(s) from tests2, optionally update .expect"
489 @echo
"make testspp.all / make testspp.17"
490 @echo
" run all/single test(s) from tests/pp"
492 @echo
"Other supported make targets:"
493 @echo
" install install-strip doc clean tags ETAGS tar distclean help"
495 @echo
"Custom configuration:"
496 @echo
" The makefile includes a file 'config-extra.mak' if it is present."
497 @echo
" This file may contain some custom configuration. For example:"
498 @echo
" NATIVE_DEFINES += -D..."
499 @echo
" Or for example to configure the search paths for a cross-compiler"
500 @echo
" that expects the linux files in <tccdir>/i386-linux:"
501 @echo
" ROOT-i386 = {B}/i386-linux"
502 @echo
" CRT-i386 = {B}/i386-linux/usr/lib"
503 @echo
" LIB-i386 = {B}/i386-linux/lib:{B}/i386-linux/usr/lib"
504 @echo
" INC-i386 = {B}/lib/include:{B}/i386-linux/usr/include"
505 @echo
" DEF-i386 += -D__linux__"
506 @echo
" Or to configure a cross compiler for system-files in /usr/<triplet>"
507 @echo
" TRIPLET-arm-eabi = arm-linux-gnueabi"
509 # --------------------------------------------------------------------------
510 endif # ($(INCLUDED),no)