History

configure: use relative paths for in-tree build

Also - move CPPFLAGS to Makefile - Use top_srcdir in lib/Makefile

grischka committed 13 years ago

Commit 17cf0dc1 parent 6ccee6e3 files · +19 −16Browse files

Unified · Split

3 files
  1. Makefile +2 −0
  2. configure +15 −14
  3. lib/Makefile +2 −2
Makefile+2−0
@@ -6,6 +6,8 @@ TOP ?= . · 5 unmodified lines
66 include $(TOP)/config.mak
77 VPATH = $(top_srcdir)
88
9+CPPFLAGS = -I$(TOP) # for config.h
10+
911 CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
1012 CFLAGS_P=$(CFLAGS) -pg -static
1113 LIBS_P=
configure+15−14
@@ -409,14 +409,14 @@ print_var2 CONFIG_TCC_LIBPATHS "$tcc_libpaths" · 408 unmodified lines
409409 print_var2 CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
410410 print_var2 CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
411411
412−echo "CC=$cc" >> config.mak
413−echo "GCC_MAJOR=$gcc_major" >> config.mak
414412 echo "#define GCC_MAJOR $gcc_major" >> $TMPH
415−echo "HOST_CC=$host_cc" >> config.mak
416−echo "AR=$ar" >> config.mak
417−echo "STRIP=$strip -s -R .comment -R .note" >> config.mak
413+
418414 cat >> config.mak <<EOF
419−CPPFLAGS = -I. -I\$(top_srcdir)
415+CC=$cc
416+GCC_MAJOR=$gcc_major
417+HOST_CC=$host_cc
418+AR=$ar
419+STRIP=$strip -s -R .comment -R .note
420420 CFLAGS=$CFLAGS
421421 LDFLAGS=$LDFLAGS
422422 LIBSUF=$LIBSUF
@@ -491,10 +491,12 @@ if test "$have_selinux" = "yes" ; then · 68 unmodified lines
491491 echo "#define HAVE_SELINUX" >> $TMPH
492492 echo "HAVE_SELINUX=yes" >> config.mak
493493 fi
494+
494495 version=`head $source_path/VERSION`
495496 echo "VERSION=$version" >>config.mak
496497 echo "#define TCC_VERSION \"$version\"" >> $TMPH
497498 echo "@set VERSION $version" > config.texi
499+echo "SRC_PATH=$source_path" >>config.mak
498500
499501 # build tree in object directory if source path is different from current one
500502 if test "$source_path_used" = "yes" ; then
@@ -511,15 +513,14 @@ if test "$source_path_used" = "yes" ; then · 10 unmodified lines
511513 esac
512514 ln -sf $dest $f
513515 done
516+ case $source_path in
517+ /*) echo "top_srcdir=$source_path";;
518+ *) echo "top_srcdir=\$(TOP)/$source_path";;
519+ esac >>config.mak
520+else
521+ echo 'top_srcdir=$(TOP)' >>config.mak
514522 fi
515−cat >>config.mak <<EOF
516−SRC_PATH = $source_path
517−top_builddir = \$(TOP)
518−EOF
519−case $source_path in
520− /*) echo 'top_srcdir = $(SRC_PATH)';;
521− *) echo 'top_srcdir = $(TOP)/$(SRC_PATH)';;
522−esac >>config.mak
523+echo 'top_builddir=$(TOP)' >>config.mak
523524
524525 diff $TMPH config.h >/dev/null 2>&1
525526 if test $? -ne 0 ; then
lib/Makefile+2−2
@@ -46,13 +46,13 @@ WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o · 45 unmodified lines
4646 ifeq "$(TARGET)" "i386-win32"
4747 OBJ = $(addprefix $(DIR)/,$(WIN32_O))
4848 TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
49− XCC = $(TCC) -B$(TOP)/win32 -I$(TOP)/include
49+ XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
5050 XAR = $(DIR)/tiny_libmaker$(EXESUF)
5151 else
5252 ifeq "$(TARGET)" "x86_64-win32"
5353 OBJ = $(addprefix $(DIR)/,$(WIN64_O))
5454 TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
55− XCC = $(TCC) -B$(TOP)/win32 -I$(TOP)/include
55+ XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
5656 XAR = $(DIR)/tiny_libmaker$(EXESUF)
5757 else
5858 ifeq "$(TARGET)" "i386"