History

add --disable-static option to build libtcc.so instead of libtcc.a for distros that want static libs

Henry Kroll III committed 16 years ago

Commit a4ed5871 parent 15783222 files · +33 −10Browse files

Unified · Split

2 files
  1. Makefile +27 −10
  2. configure +6 −0
Makefile+27−10
@@ -8,6 +8,18 @@ include $(TOP)/config.mak · 7 unmodified lines
8CFLAGS+=-g -Wall8CFLAGS+=-g -Wall
9CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC9CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
10LIBS_P=10LIBS_P=
11LIBS=.
12
13# My distro wants shared libs, not static ones
14LIBTCCA=libtcc.a
15ifdef DISABLE_STATIC
16CFLAGS+=-fPIC
17LIBTCCA=
18LIBTCCL=-ltcc
19LIBTCCSO=libtcc.so.1
20endif
21LIBTCCB=$(LIBTCCA)
22LIBTCCB+=$(LIBTCCSO)
11 23
12ifneq ($(GCC_MAJOR),2)24ifneq ($(GCC_MAJOR),2)
13CFLAGS+=-fno-strict-aliasing25CFLAGS+=-fno-strict-aliasing
@@ -117,11 +129,11 @@ ifdef CONFIG_CROSS · 103 unmodified lines
117PROGS+=$(PROGS_CROSS)129PROGS+=$(PROGS_CROSS)
118endif130endif
119 131
120all: $(PROGS) $(LIBTCC1) $(BCHECK_O) libtcc.a tcc-doc.html tcc.1 libtcc_test$(EXESUF)132all: $(PROGS) $(LIBTCC1) $(BCHECK_O) $(LIBTCCB) tcc-doc.html tcc.1 libtcc_test$(EXESUF)
121 133
122# Host Tiny C Compiler134# Host Tiny C Compiler
123tcc$(EXESUF): tcc.o libtcc.a135tcc$(EXESUF): tcc.o $(LIBTCCA)
124 $(CC) -o $@ $^ $(LIBS)136 $(CC) -o $@ $^ $(LIBS) $(LIBTCCL)
125 137
126# Cross Tiny C Compilers138# Cross Tiny C Compilers
127%-tcc$(EXESUF):139%-tcc$(EXESUF):
@@ -163,8 +175,13 @@ $(LIBTCC_OBJ) tcc.o : %.o : %.c $(LIBTCC_INC) · 35 unmodified lines
163libtcc.a: $(LIBTCC_OBJ)175libtcc.a: $(LIBTCC_OBJ)
164 $(AR) rcs $@ $^176 $(AR) rcs $@ $^
165 177
166libtcc_test$(EXESUF): tests/libtcc_test.c libtcc.a178libtcc.so.1: $(LIBTCC_OBJ)
167 $(CC) -o $@ $^ -I. $(CFLAGS) $(LIBS)179 $(CC) -shared -Wl,-soname,$@ -o $@.0 $^
180 ln -sf libtcc.so.1.0 libtcc.so.1
181 ln -sf libtcc.so.1.0 libtcc.so
182
183libtcc_test$(EXESUF): tests/libtcc_test.c $(LIBTCCA)
184 $(CC) -o $@ $^ -I. $(CFLAGS) $(LIBS) $(LIBTCCL)
168 185
169libtest: libtcc_test$(EXESUF) $(LIBTCC1)186libtest: libtcc_test$(EXESUF) $(LIBTCC1)
170 ./libtcc_test$(EXESUF) lib_path=.187 ./libtcc_test$(EXESUF) lib_path=.
@@ -204,7 +221,7 @@ TCC_INCLUDES = stdarg.h stddef.h stdbool.h float.h varargs.h tcclib.h · 33 unmodified lines
204INSTALL=install221INSTALL=install
205 222
206ifndef CONFIG_WIN32223ifndef CONFIG_WIN32
207install: $(PROGS) $(LIBTCC1) $(BCHECK_O) libtcc.a tcc.1 tcc-doc.html224install: $(PROGS) $(LIBTCC1) $(BCHECK_O) $(LIBTCCB) tcc.1 tcc-doc.html
208 mkdir -p "$(bindir)"225 mkdir -p "$(bindir)"
209 $(INSTALL) -s -m755 $(PROGS) "$(bindir)"226 $(INSTALL) -s -m755 $(PROGS) "$(bindir)"
210 mkdir -p "$(mandir)/man1"227 mkdir -p "$(mandir)/man1"
@@ -219,7 +236,7 @@ ifneq ($(BCHECK_O),) · 8 unmodified lines
219endif236endif
220 $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"237 $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
221 mkdir -p "$(libdir)"238 mkdir -p "$(libdir)"
222 $(INSTALL) -m644 libtcc.a "$(libdir)"239 $(INSTALL) -m644 $(LIBTCCB) "$(libdir)"
223 mkdir -p "$(includedir)"240 mkdir -p "$(includedir)"
224 $(INSTALL) -m644 libtcc.h "$(includedir)"241 $(INSTALL) -m644 libtcc.h "$(includedir)"
225 mkdir -p "$(docdir)"242 mkdir -p "$(docdir)"
@@ -230,7 +247,7 @@ uninstall: · 4 unmodified lines
230 rm -fv $(foreach P,$(LIBTCC1) $(BCHECK_O),"$(tccdir)/$P")247 rm -fv $(foreach P,$(LIBTCC1) $(BCHECK_O),"$(tccdir)/$P")
231 rm -fv $(foreach P,$(TCC_INCLUDES),"$(tccdir)/include/$P")248 rm -fv $(foreach P,$(TCC_INCLUDES),"$(tccdir)/include/$P")
232 rm -fv "$(docdir)/tcc-doc.html" "$(mandir)/man1/tcc.1"249 rm -fv "$(docdir)/tcc-doc.html" "$(mandir)/man1/tcc.1"
233 rm -fv "$(libdir)/libtcc.a" "$(includedir)/libtcc.h"250 rm -fv "$(libdir)/$(LIBTCCB)" "$(includedir)/libtcc.h"
234 251
235else252else
236install: $(PROGS) $(LIBTCC1) libtcc.a tcc-doc.html253install: $(PROGS) $(LIBTCC1) libtcc.a tcc-doc.html
@@ -246,7 +263,7 @@ install: $(PROGS) $(LIBTCC1) libtcc.a tcc-doc.html · 9 unmodified lines
246 cp -r win32/examples/. "$(tccdir)/examples"263 cp -r win32/examples/. "$(tccdir)/examples"
247 $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"264 $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
248 $(INSTALL) -m644 tcc-doc.html win32/tcc-win32.txt "$(tccdir)/doc"265 $(INSTALL) -m644 tcc-doc.html win32/tcc-win32.txt "$(tccdir)/doc"
249 $(INSTALL) -m644 libtcc.a libtcc.h "$(tccdir)/libtcc"266 $(INSTALL) -m644 $(LIBTCCB) libtcc.h "$(tccdir)/libtcc"
250endif267endif
251 268
252# documentation and man page269# documentation and man page
@@ -270,7 +287,7 @@ tar: · 17 unmodified lines
270 $(MAKE) -C tests $@287 $(MAKE) -C tests $@
271 288
272clean:289clean:
273 rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.out libtcc_test$(EXESUF)290 rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.out *.so* *.exe libtcc_test$(EXESUF)
274 $(MAKE) -C tests $@291 $(MAKE) -C tests $@
275 292
276distclean: clean293distclean: clean
configure+6−0
@@ -128,6 +128,8 @@ for opt do · 127 unmodified lines
128 ;; 128 ;;
129 --enable-cross) build_cross="yes"129 --enable-cross) build_cross="yes"
130 ;;130 ;;
131 --disable-static) disable_static="yes"
132 ;;
131 --with-libgcc) use_libgcc="yes"133 --with-libgcc) use_libgcc="yes"
132 ;;134 ;;
133 --with-selinux) have_selinux="yes"135 --with-selinux) have_selinux="yes"
@@ -230,6 +232,7 @@ echo " --source-path=PATH path of source code [$source_path]" · 96 unmodified lines
230echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"232echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
231echo " --sysroot=PREFIX prepend PREFIX to library/include paths []"233echo " --sysroot=PREFIX prepend PREFIX to library/include paths []"
232echo " --cc=CC use C compiler CC [$cc]"234echo " --cc=CC use C compiler CC [$cc]"
235echo " --disable-static make libtcc.so instead of libtcc.a"
233echo " --with-libgcc use /lib/libgcc_s.so.1 instead of libtcc1.a"236echo " --with-libgcc use /lib/libgcc_s.so.1 instead of libtcc1.a"
234echo " --with-selinux use mmap instead of exec mem"237echo " --with-selinux use mmap instead of exec mem"
235echo " [requires write access to /tmp]"238echo " [requires write access to /tmp]"
@@ -357,6 +360,9 @@ fi · 121 unmodified lines
357if test "$build_cross" = "yes" ; then360if test "$build_cross" = "yes" ; then
358 echo "CONFIG_CROSS=yes" >> config.mak361 echo "CONFIG_CROSS=yes" >> config.mak
359fi362fi
363if test "$disable_static" = "yes" ; then
364 echo "DISABLE_STATIC=yes" >> config.mak
365fi
360if test "$use_libgcc" = "yes" ; then366if test "$use_libgcc" = "yes" ; then
361 echo "#define CONFIG_USE_LIBGCC" >> $TMPH367 echo "#define CONFIG_USE_LIBGCC" >> $TMPH
362 echo "CONFIG_USE_LIBGCC=yes" >> config.mak368 echo "CONFIG_USE_LIBGCC=yes" >> config.mak

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t