aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgus knight <waddlesplash@gmail.com>2015-07-27 16:03:25 -0400
committerAugustin Cavalier <waddlesplash@gmail.com>2015-07-27 16:03:25 -0400
commit47e06c6d4e542e47fcbad69a78c2436a854a0779 (patch)
treed979fb8f3372966c0ef3031c4edeaa8f017241d9
parent694d0fdade8bff3bc03466675350f596b2f4f8ed (diff)
downloadtinycc-47e06c6d4e542e47fcbad69a78c2436a854a0779.tar.gz
tinycc-47e06c6d4e542e47fcbad69a78c2436a854a0779.tar.bz2
Reorganize the source tree.
* Documentation is now in "docs". * Source code is now in "src". * Misc. fixes here and there so that everything still works. I think I got everything in this commit, but I only tested this on Linux (Make) and Windows (CMake), so I might've messed something up on other platforms...
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt51
-rwxr-xr-xconfigure8
-rw-r--r--docs/Changelog (renamed from Changelog)0
-rw-r--r--docs/CodingStyle.md (renamed from CodingStyle.md)0
-rw-r--r--docs/TODO (renamed from TODO)0
-rw-r--r--docs/config.texi.in (renamed from config.texi.in)0
-rw-r--r--docs/tcc-doc.texi (renamed from tcc-doc.texi)0
-rw-r--r--[-rwxr-xr-x]docs/texi2pod.pl (renamed from texi2pod.pl)0
-rw-r--r--lib/Makefile16
-rw-r--r--src/Makefile (renamed from Makefile)42
-rw-r--r--src/arm/arm-gen.c (renamed from arm-gen.c)2
-rw-r--r--src/arm/arm64-gen.c (renamed from arm64-gen.c)2
-rw-r--r--src/cil/il-gen.c (renamed from il-gen.c)0
-rw-r--r--src/cil/il-opcodes.h (renamed from il-opcodes.h)0
-rw-r--r--src/coff.h (renamed from coff.h)0
-rw-r--r--src/config.h.in (renamed from config.h.in)0
-rw-r--r--src/conftest.c (renamed from conftest.c)0
-rw-r--r--src/elf.h (renamed from elf.h)0
-rw-r--r--src/libtcc.c (renamed from libtcc.c)12
-rw-r--r--src/libtcc.h (renamed from libtcc.h)0
-rw-r--r--src/stab.def (renamed from stab.def)0
-rw-r--r--src/stab.h (renamed from stab.h)0
-rw-r--r--src/tcc.c (renamed from tcc.c)0
-rw-r--r--src/tcc.h (renamed from tcc.h)10
-rw-r--r--src/tccasm.c (renamed from tccasm.c)0
-rw-r--r--src/tcccoff.c (renamed from tcccoff.c)0
-rw-r--r--src/tccelf.c (renamed from tccelf.c)2
-rw-r--r--src/tccgen.c (renamed from tccgen.c)0
-rw-r--r--src/tcclib.h (renamed from tcclib.h)0
-rw-r--r--src/tccpe.c (renamed from tccpe.c)2
-rw-r--r--src/tccpp.c (renamed from tccpp.c)0
-rw-r--r--src/tccrun.c (renamed from tccrun.c)0
-rw-r--r--src/tcctok.h (renamed from tcctok.h)2
-rw-r--r--src/tms320c67/c67-gen.c (renamed from c67-gen.c)2
-rw-r--r--src/x86/i386-asm.c (renamed from i386-asm.c)2
-rw-r--r--src/x86/i386-asm.h (renamed from i386-asm.h)0
-rw-r--r--src/x86/i386-gen.c (renamed from i386-gen.c)2
-rw-r--r--src/x86/i386-tok.h (renamed from i386-tok.h)0
-rw-r--r--src/x86/x86_64-asm.h (renamed from x86_64-asm.h)0
-rw-r--r--src/x86/x86_64-gen.c (renamed from x86_64-gen.c)2
-rw-r--r--tests/Makefile10
-rw-r--r--tests/pp/Makefile2
-rw-r--r--tests/tests2/Makefile6
-rw-r--r--win32/tools/tiny_libmaker.c2
45 files changed, 90 insertions, 91 deletions
diff --git a/.gitignore b/.gitignore
index 1aff332..48f59c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,7 +5,7 @@ a.out
*.log
tcc_g
tcc
-/*-tcc
+/src/*-tcc
tc2.c
doc
tc3s.c
@@ -63,7 +63,7 @@ lib/i386-win32
lib/arm
lib/arm64
tcc-doc.info
-conftest*
+conftest*!conftest.c
tiny_libmaker
*.dSYM
*~
diff --git a/CMakeLists.txt b/CMakeLists.txt
index effa22d..50a9f84 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -85,14 +85,14 @@ endif()
file(STRINGS "VERSION" TCC_VERSION)
list(GET TCC_VERSION 0 TCC_VERSION)
-include_directories(${CMAKE_BINARY_DIR})
-configure_file(config.h.in config.h)
-configure_file(config.texi.in config.texi)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/)
+configure_file(src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h)
+configure_file(docs/config.texi.in ${CMAKE_CURRENT_SOURCE_DIR}/docs/config.texi)
# Utility variables
-set(I386_SOURCES i386-gen.c i386-asm.c i386-asm.h i386-tok.h)
-set(X86_64_SOURCES x86_64-gen.c i386-asm.c x86_64-asm.h)
-set(ARM_SOURCES arm_gen.c)
+set(I386_SOURCES src/x86/i386-gen.c src/x86/i386-asm.c src/x86/i386-asm.h src/x86/i386-tok.h)
+set(X86_64_SOURCES src/x86/x86_64-gen.c src/x86/i386-asm.c src/x86/x86_64-asm.h)
+set(ARM_SOURCES src/arm/arm_gen.c)
set(LIBTCC1_I386_SOURCES lib/alloca86.S lib/alloca86-bt.S)
set(LIBTCC1_WIN_SOURCES win32/lib/crt1.c win32/lib/wincrt1.c win32/lib/dllcrt1.c win32/lib/dllmain.c win32/lib/chkstk.S)
@@ -157,22 +157,22 @@ macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libt
if (TCC_BUILD_NATIVE)
add_library(libtcc
- libtcc.c
- tccpp.c
- tccgen.c
- tccelf.c
- tccasm.c
- tccrun.c
- tcc.h
- libtcc.h
- tcctok.h
+ src/libtcc.c
+ src/tccpp.c
+ src/tccgen.c
+ src/tccelf.c
+ src/tccasm.c
+ src/tccrun.c
+ src/tcc.h
+ src/libtcc.h
+ src/tcctok.h
${tcc_sources}
)
set_target_properties(libtcc PROPERTIES OUTPUT_NAME tcc PREFIX lib)
if(WIN32)
set_target_properties(libtcc PROPERTIES LINK_FLAGS "-Wl,--output-def,libtcc.def")
endif()
- add_executable(tcc tcc.c)
+ add_executable(tcc src/tcc.c)
target_link_libraries(tcc libtcc)
if(NOT WIN32)
target_link_libraries(tcc dl)
@@ -185,7 +185,7 @@ macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libt
endif()
endif()
elseif(${cross_enabled})
- add_executable(${cross_name}-tcc tcc.c)
+ add_executable(${cross_name}-tcc src/tcc.c)
set_target_properties(${cross_name}-tcc PROPERTIES COMPILE_DEFINITIONS "ONE_SOURCE;${definitions}")
install(TARGETS ${cross_name}-tcc RUNTIME DESTINATION ${EXE_PATH})
@@ -197,17 +197,17 @@ endmacro()
make_tcc("Win32" i386-w64-mingw32 TCC_BUILD_WIN32
"TCC_TARGET_I386;TCC_TARGET_PE"
- "${I386_SOURCES};tccpe.c"
+ "${I386_SOURCES};src/tccpe.c"
tiny_libmaker_32 "${LIBTCC1_I386_SOURCES};${LIBTCC1_WIN_SOURCES}" "win32/include;win32/include/winapi"
)
make_tcc("Win64" x86_64-w64-mingw32 TCC_BUILD_WIN64
"TCC_TARGET_X86_64;TCC_TARGET_PE"
- "${X86_64_SOURCES};tccpe.c"
+ "${X86_64_SOURCES};src/tccpe.c"
tiny_libmaker_64 "lib/alloca86_64.S;${LIBTCC1_WIN_SOURCES}" "win32/include;win32/include/winapi"
)
make_tcc("WinCE" arm-wince-mingw32ce TCC_BUILD_WINCE
"TCC_TARGET_ARM;TCC_ARM_VERSION=${TCC_ARM_VERSION};TCC_TARGET_PE"
- "${ARM_SOURCES};tccpe.c"
+ "${ARM_SOURCES};src/tccpe.c"
"" "" ""
)
make_tcc("i386" i386-linux-gnu TCC_BUILD_I386
@@ -248,7 +248,7 @@ make_tcc("" arm-linux-gnu TCC_BUILD_ARM_VFP
)
make_tcc("" c67 TCC_BUILD_C67
TCC_TARGET_C67
- "c67-gen.c;tcccoff.c"
+ "c67-gen.c;src/tcccoff.c"
"" "" ""
)
@@ -257,14 +257,14 @@ add_subdirectory(tests)
find_program(MAKEINFO NAMES makeinfo PATHS C:/MinGW/MSYS/1.0/bin)
if(MAKEINFO)
add_custom_command(OUTPUT tcc-doc.html
- COMMAND ${MAKEINFO} --no-split --html -o tcc-doc.html ${CMAKE_CURRENT_SOURCE_DIR}/tcc-doc.texi
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tcc-doc.texi
+ COMMAND ${MAKEINFO} --no-split --html -o tcc-doc.html ${CMAKE_CURRENT_SOURCE_DIR}/docs/tcc-doc.texi
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docs/tcc-doc.texi
)
set(TCC_DOC_FILES tcc-doc.html)
if(NOT WIN32)
add_custom_command(OUTPUT tcc-doc.info
- COMMAND ${MAKEINFO} -o tcc-doc.info ${CMAKE_CURRENT_SOURCE_DIR}/tcc-doc.texi
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tcc-doc.texi
+ COMMAND ${MAKEINFO} -o tcc-doc.info ${CMAKE_CURRENT_SOURCE_DIR}/docs/tcc-doc.texi
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docs/tcc-doc.texi
)
set(TCC_DOC_FILES ${TCC_DOC_FILES} tcc-doc.info)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tcc-doc.info DESTINATION share/info)
@@ -290,4 +290,3 @@ else()
install(DIRECTORY win32/include/ DESTINATION lib/tcc/win32/include)
install(DIRECTORY include/ DESTINATION lib/tcc/win32/include)
endif()
-
diff --git a/configure b/configure
index 3121330..f00a6b6 100755
--- a/configure
+++ b/configure
@@ -337,7 +337,7 @@ strip="${cross_prefix}${strip}"
CONFTEST=./conftest$EXESUF
if test -z "$cross_prefix" ; then
- if ! $cc -o $CONFTEST $source_path/conftest.c 2>/dev/null ; then
+ if ! $cc -o $CONFTEST $source_path/src/conftest.c 2>/dev/null ; then
echo "configure: error: '$cc' failed to compile conftest.c."
else
bigendian="$($CONFTEST bigendian)"
@@ -560,7 +560,7 @@ fi
version=`head $source_path/VERSION`
echo "VERSION=$version" >>config.mak
echo "#define TCC_VERSION \"$version\"" >> $TMPH
-echo "@set VERSION $version" > config.texi
+echo "@set VERSION $version" >docs/config.texi
echo "SRC_PATH=$source_path" >>config.mak
if test "$source_path_used" = "yes" ; then
@@ -573,9 +573,9 @@ else
fi
echo 'top_builddir=$(TOP)' >>config.mak
-diff $TMPH config.h >/dev/null 2>&1
+diff $TMPH src/config.h >/dev/null 2>&1
if test $? -ne 0 ; then
- mv -f $TMPH config.h
+ mv -f $TMPH src/config.h
else
echo "config.h is unchanged"
fi
diff --git a/Changelog b/docs/Changelog
index 7cc19c8..7cc19c8 100644
--- a/Changelog
+++ b/docs/Changelog
diff --git a/CodingStyle.md b/docs/CodingStyle.md
index 303c1fb..303c1fb 100644
--- a/CodingStyle.md
+++ b/docs/CodingStyle.md
diff --git a/TODO b/docs/TODO
index ea57823..ea57823 100644
--- a/TODO
+++ b/docs/TODO
diff --git a/config.texi.in b/docs/config.texi.in
index 259ef19..259ef19 100644
--- a/config.texi.in
+++ b/docs/config.texi.in
diff --git a/tcc-doc.texi b/docs/tcc-doc.texi
index c673c2c..c673c2c 100644
--- a/tcc-doc.texi
+++ b/docs/tcc-doc.texi
diff --git a/texi2pod.pl b/docs/texi2pod.pl
index a8f823f..a8f823f 100755..100644
--- a/texi2pod.pl
+++ b/docs/texi2pod.pl
diff --git a/lib/Makefile b/lib/Makefile
index 348cb72..e747b98 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,9 +2,9 @@
# Tiny C Compiler Makefile for libtcc1.a
#
-TOP = ..
+TOP = ../src
include $(TOP)/Makefile
-VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib
+VPATH = $(top_srcdir)/../lib $(top_srcdir)/../win32/lib
ifndef TARGET # native library
ifdef CONFIG_WIN64
@@ -37,7 +37,7 @@ endif
BCHECK_O = bcheck.o
DIR = $(TARGET)
-native : ../libtcc1.a
+native : $(DIR)/libtcc1.a
cross : $(DIR)/libtcc1.a
native : TCC = $(TOP)/tcc$(EXESUF)
@@ -61,26 +61,26 @@ CFLAGS := $(filter-out -fstack-protector-strong,$(CFLAGS))
ifeq "$(TARGET)" "i386-win"
OBJ = $(addprefix $(DIR)/,$(WIN32_O))
TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
- XCC ?= $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
+ XCC ?= $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/../include
XAR ?= $(DIR)/tiny_libmaker$(EXESUF)
PICFLAGS =
else
ifeq "$(TARGET)" "x86_64-win"
OBJ = $(addprefix $(DIR)/,$(WIN64_O))
TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
- XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
+ XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/../include
XAR ?= $(DIR)/tiny_libmaker$(EXESUF)
PICFLAGS =
else
ifeq "$(TARGET)" "i386"
OBJ = $(addprefix $(DIR)/,$(I386_O))
TGT = -DTCC_TARGET_I386
- XCC ?= $(TCC) -B$(TOP)
+ XCC ?= $(TCC) -B$(TOP) -I$(top_srcdir)/../include
else
ifeq "$(TARGET)" "x86_64"
OBJ = $(addprefix $(DIR)/,$(X86_64_O))
TGT = -DTCC_TARGET_X86_64
- XCC ?= $(TCC) -B$(TOP)
+ XCC ?= $(TCC) -B$(TOP) -I$(top_srcdir)/../include
else
ifeq "$(TARGET)" "arm"
OBJ = $(addprefix $(DIR)/,$(ARM_O))
@@ -110,7 +110,7 @@ endif
XAR ?= $(AR)
-$(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR)
+$(DIR)/libtcc1.a : $(OBJ) $(XAR)
$(XAR) rcs $@ $(OBJ)
$(DIR)/%.o : %.c
$(XCC) -c $< -o $@ $(XFLAGS)
diff --git a/Makefile b/src/Makefile
index 2045978..a098a76 100644
--- a/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@
#
TOP ?= .
-include $(TOP)/config.mak
+include $(TOP)/../config.mak
VPATH = $(top_srcdir)
CPPFLAGS += -I$(TOP) # for config.h
@@ -113,14 +113,14 @@ endif
CORE_FILES = tcc.c libtcc.c tccpp.c tccgen.c tccelf.c tccasm.c tccrun.c
CORE_FILES += tcc.h config.h libtcc.h tcctok.h
-I386_FILES = $(CORE_FILES) i386-gen.c i386-asm.c i386-asm.h i386-tok.h
-WIN32_FILES = $(CORE_FILES) i386-gen.c i386-asm.c i386-asm.h i386-tok.h tccpe.c
-WIN64_FILES = $(CORE_FILES) x86_64-gen.c i386-asm.c x86_64-asm.h tccpe.c
-WINCE_FILES = $(CORE_FILES) arm-gen.c tccpe.c
-X86_64_FILES = $(CORE_FILES) x86_64-gen.c i386-asm.c x86_64-asm.h
-ARM_FILES = $(CORE_FILES) arm-gen.c
-ARM64_FILES = $(CORE_FILES) arm64-gen.c
-C67_FILES = $(CORE_FILES) c67-gen.c tcccoff.c
+I386_FILES = $(CORE_FILES) x86/i386-gen.c x86/i386-asm.c x86/i386-asm.h x86/i386-tok.h
+WIN32_FILES = $(CORE_FILES) x86/i386-gen.c x86/i386-asm.c x86/i386-asm.h x86/i386-tok.h tccpe.c
+WIN64_FILES = $(CORE_FILES) x86/x86_64-gen.c x86/i386-asm.c x86/x86_64-asm.h tccpe.c
+WINCE_FILES = $(CORE_FILES) arm/arm-gen.c tccpe.c
+X86_64_FILES = $(CORE_FILES) x86/x86_64-gen.c x86/i386-asm.c x86/x86_64-asm.h
+ARM_FILES = $(CORE_FILES) arm/arm-gen.c
+ARM64_FILES = $(CORE_FILES) arm/arm64-gen.c
+C67_FILES = $(CORE_FILES) tms320c67/c67-gen.c tcccoff.c
ifdef CONFIG_WIN64
PROGS+=tiny_impdef$(EXESUF) tiny_libmaker$(EXESUF)
@@ -249,18 +249,18 @@ libtcc.dll libtcc.def libtcc.a: $(LIBTCC_OBJ)
endif
# windows utilities
-tiny_impdef$(EXESUF): win32/tools/tiny_impdef.c
+tiny_impdef$(EXESUF): ../win32/tools/tiny_impdef.c
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
-tiny_libmaker$(EXESUF): win32/tools/tiny_libmaker.c
+tiny_libmaker$(EXESUF): ../win32/tools/tiny_libmaker.c
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
# TinyCC runtime libraries
libtcc1.a : FORCE
- $(MAKE) -C lib native
+ $(MAKE) -C ../lib native
if test ! -d $(ARCH); then mkdir $(ARCH); fi
if test ! -L $(ARCH)/$@; then ln -sf ../$@ $(ARCH)/$@; fi
lib/%/libtcc1.a : FORCE $(PROGS_CROSS)
- $(MAKE) -C lib cross TARGET=$*
+ $(MAKE) -C ../lib cross TARGET=$*
FORCE:
@@ -360,21 +360,21 @@ uninstall:
endif
# documentation and man page
-tcc-doc.html: tcc-doc.texi
+tcc-doc.html: ../docs/tcc-doc.texi
-makeinfo --no-split --html --number-sections -o $@ $<
-tcc.1: tcc-doc.texi
+tcc.1: ../docs/tcc-doc.texi
-$(top_srcdir)/texi2pod.pl $< tcc.pod
- -pod2man --section=1 --center="Tiny C Compiler" --release=`cat $(top_srcdir)/VERSION` tcc.pod > $@
+ -pod2man --section=1 --center="Tiny C Compiler" --release=`cat $(top_srcdir)/../VERSION` tcc.pod > $@
-tcc-doc.info: tcc-doc.texi
+tcc-doc.info: ../docs/tcc-doc.texi
-makeinfo $<
# in tests subdir
export LIBTCC1
%est:
- $(MAKE) -C tests $@ 'PROGS_CROSS=$(PROGS_CROSS)'
+ $(MAKE) -C ../tests $@ 'PROGS_CROSS=$(PROGS_CROSS)'
clean:
rm -vf $(PROGS) tcc_p$(EXESUF) tcc.pod *~ *.o *.a *.so* *.out *.log \
@@ -384,9 +384,9 @@ ifeq ($(HOST_OS),Linux)
-rm -r ./C:
endif
-rm *-tcc$(EXESUF)
- $(MAKE) -C tests $@
+ $(MAKE) -C ../tests $@
ifneq ($(LIBTCC1),)
- $(MAKE) -C lib $@
+ $(MAKE) -C ../lib $@
endif
distclean: clean
@@ -404,7 +404,7 @@ TAGS:
# create release tarball from *current* git branch (including tcc-doc.html
# and converting two files to CRLF)
-TCC-VERSION := tcc-$(shell cat $(top_srcdir)/VERSION)
+TCC-VERSION := tcc-$(shell cat $(top_srcdir)/../VERSION)
tar: tcc-doc.html
mkdir $(TCC-VERSION)
( cd $(TCC-VERSION) && git --git-dir ../.git checkout -f )
diff --git a/arm-gen.c b/src/arm/arm-gen.c
index ddb3917..f31fb88 100644
--- a/arm-gen.c
+++ b/src/arm/arm-gen.c
@@ -151,7 +151,7 @@ enum float_abi {
/******************************************************/
#else /* ! TARGET_DEFS_ONLY */
/******************************************************/
-#include "tcc.h"
+#include "../tcc.h"
enum float_abi float_abi;
diff --git a/arm64-gen.c b/src/arm/arm64-gen.c
index 62447e7..fe3d7aa 100644
--- a/arm64-gen.c
+++ b/src/arm/arm64-gen.c
@@ -58,7 +58,7 @@ typedef int RegArgs;
/******************************************************/
#else /* ! TARGET_DEFS_ONLY */
/******************************************************/
-#include "tcc.h"
+#include "../tcc.h"
#include <assert.h>
ST_DATA const int reg_classes[NB_REGS] = {
diff --git a/il-gen.c b/src/cil/il-gen.c
index a4170b0..a4170b0 100644
--- a/il-gen.c
+++ b/src/cil/il-gen.c
diff --git a/il-opcodes.h b/src/cil/il-opcodes.h
index adf35cf..adf35cf 100644
--- a/il-opcodes.h
+++ b/src/cil/il-opcodes.h
diff --git a/coff.h b/src/coff.h
index 63edfe2..63edfe2 100644
--- a/coff.h
+++ b/src/coff.h
diff --git a/config.h.in b/src/config.h.in
index c9e1a18..c9e1a18 100644
--- a/config.h.in
+++ b/src/config.h.in
diff --git a/conftest.c b/src/conftest.c
index fa07a1b..fa07a1b 100644
--- a/conftest.c
+++ b/src/conftest.c
diff --git a/elf.h b/src/elf.h
index a40c736..a40c736 100644
--- a/elf.h
+++ b/src/elf.h
diff --git a/libtcc.c b/src/libtcc.c
index f4f01c2..f600280 100644
--- a/libtcc.c
+++ b/src/libtcc.c
@@ -40,24 +40,24 @@ ST_DATA struct TCCState *tcc_state;
#include "tccelf.c"
#include "tccrun.c"
#ifdef TCC_TARGET_I386
-#include "i386-gen.c"
+#include "x86/i386-gen.c"
#endif
#ifdef TCC_TARGET_ARM
-#include "arm-gen.c"
+#include "arm/arm-gen.c"
#endif
#ifdef TCC_TARGET_ARM64
-#include "arm64-gen.c"
+#include "arm/arm64-gen.c"
#endif
#ifdef TCC_TARGET_C67
-#include "c67-gen.c"
+#include "tms320c67/c67-gen.c"
#endif
#ifdef TCC_TARGET_X86_64
-#include "x86_64-gen.c"
+#include "x86/x86_64-gen.c"
#endif
#ifdef CONFIG_TCC_ASM
#include "tccasm.c"
#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
-#include "i386-asm.c"
+#include "x86/i386-asm.c"
#endif
#endif
#ifdef TCC_TARGET_COFF
diff --git a/libtcc.h b/src/libtcc.h
index 97b8587..97b8587 100644
--- a/libtcc.h
+++ b/src/libtcc.h
diff --git a/stab.def b/src/stab.def
index 48ea231..48ea231 100644
--- a/stab.def
+++ b/src/stab.def
diff --git a/stab.h b/src/stab.h
index 80bd594..80bd594 100644
--- a/stab.h
+++ b/src/stab.h
diff --git a/tcc.c b/src/tcc.c
index cce9699..cce9699 100644
--- a/tcc.c
+++ b/src/tcc.c
diff --git a/tcc.h b/src/tcc.h
index 5fa6ba4..eb0365d 100644
--- a/tcc.h
+++ b/src/tcc.h
@@ -293,20 +293,20 @@
#define TARGET_DEFS_ONLY
#ifdef TCC_TARGET_I386
-# include "i386-gen.c"
+# include "x86/i386-gen.c"
#endif
#ifdef TCC_TARGET_X86_64
-# include "x86_64-gen.c"
+# include "x86/x86_64-gen.c"
#endif
#ifdef TCC_TARGET_ARM
-# include "arm-gen.c"
+# include "arm/arm-gen.c"
#endif
#ifdef TCC_TARGET_ARM64
-# include "arm64-gen.c"
+# include "arm/arm64-gen.c"
#endif
#ifdef TCC_TARGET_C67
# include "coff.h"
-# include "c67-gen.c"
+# include "tms320c67c67-gen.c"
#endif
#undef TARGET_DEFS_ONLY
diff --git a/tccasm.c b/src/tccasm.c
index b184c88..b184c88 100644
--- a/tccasm.c
+++ b/src/tccasm.c
diff --git a/tcccoff.c b/src/tcccoff.c
index 6ef9759..6ef9759 100644
--- a/tcccoff.c
+++ b/src/tcccoff.c
diff --git a/tccelf.c b/src/tccelf.c
index 507b598..d00fadd 100644
--- a/tccelf.c
+++ b/src/tccelf.c
@@ -1549,7 +1549,7 @@ static int tcc_add_support(TCCState *s1, const char *filename)
"i386"
#endif
#ifdef TCC_TARGET_X86_64
- "x86-64"
+ "x86_64"
#endif
#ifdef TCC_TARGET_ARM
"arm"
diff --git a/tccgen.c b/src/tccgen.c
index cf97d1f..cf97d1f 100644
--- a/tccgen.c
+++ b/src/tccgen.c
diff --git a/tcclib.h b/src/tcclib.h
index 13f2204..13f2204 100644
--- a/tcclib.h
+++ b/src/tcclib.h
diff --git a/tccpe.c b/src/tccpe.c
index a13eac7..479d084 100644
--- a/tccpe.c
+++ b/src/tccpe.c
@@ -1636,7 +1636,7 @@ quit:
/* ------------------------------------------------------------- */
#define TINY_IMPDEF_GET_EXPORT_NAMES_ONLY
-#include "win32/tools/tiny_impdef.c"
+#include "../win32/tools/tiny_impdef.c"
static int pe_load_dll(TCCState *s1, const char *dllname, int fd)
{
diff --git a/tccpp.c b/src/tccpp.c
index eed09b5..eed09b5 100644
--- a/tccpp.c
+++ b/src/tccpp.c
diff --git a/tccrun.c b/src/tccrun.c
index cb98392..cb98392 100644
--- a/tccrun.c
+++ b/src/tccrun.c
diff --git a/tcctok.h b/src/tcctok.h
index 7372f51..5972fd6 100644
--- a/tcctok.h
+++ b/src/tcctok.h
@@ -331,5 +331,5 @@
#endif
#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
-#include "i386-tok.h"
+#include "x86/i386-tok.h"
#endif
diff --git a/c67-gen.c b/src/tms320c67/c67-gen.c
index 88bfbb4..84ff78c 100644
--- a/c67-gen.c
+++ b/src/tms320c67/c67-gen.c
@@ -127,7 +127,7 @@ enum {
/******************************************************/
#else /* ! TARGET_DEFS_ONLY */
/******************************************************/
-#include "tcc.h"
+#include "../tcc.h"
ST_DATA const int reg_classes[NB_REGS] = {
/* eax */ RC_INT | RC_FLOAT | RC_EAX,
diff --git a/i386-asm.c b/src/x86/i386-asm.c
index fd320bd..adc40b2 100644
--- a/i386-asm.c
+++ b/src/x86/i386-asm.c
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "tcc.h"
+#include "../tcc.h"
/* #define NB_ASM_REGS 8 */
#define MAX_OPERANDS 3
diff --git a/i386-asm.h b/src/x86/i386-asm.h
index 2e82e0d..2e82e0d 100644
--- a/i386-asm.h
+++ b/src/x86/i386-asm.h
diff --git a/i386-gen.c b/src/x86/i386-gen.c
index 81826bd..b8b12aa 100644
--- a/i386-gen.c
+++ b/src/x86/i386-gen.c
@@ -89,7 +89,7 @@ enum {
/******************************************************/
#else /* ! TARGET_DEFS_ONLY */
/******************************************************/
-#include "tcc.h"
+#include "../tcc.h"
ST_DATA const int reg_classes[NB_REGS] = {
/* eax */ RC_INT | RC_EAX,
diff --git a/i386-tok.h b/src/x86/i386-tok.h
index b0ca3ed..b0ca3ed 100644
--- a/i386-tok.h
+++ b/src/x86/i386-tok.h
diff --git a/x86_64-asm.h b/src/x86/x86_64-asm.h
index 2f80e4b..2f80e4b 100644
--- a/x86_64-asm.h
+++ b/src/x86/x86_64-asm.h
diff --git a/x86_64-gen.c b/src/x86/x86_64-gen.c
index 4a48604..0ce5846 100644
--- a/x86_64-gen.c
+++ b/src/x86/x86_64-gen.c
@@ -136,7 +136,7 @@ enum {
/******************************************************/
#else /* ! TARGET_DEFS_ONLY */
/******************************************************/
-#include "tcc.h"
+#include "../tcc.h"
#include <assert.h>
ST_DATA const int reg_classes[NB_REGS] = {
diff --git a/tests/Makefile b/tests/Makefile
index 270eaa7..f83027f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,7 +2,7 @@
# Tiny C Compiler Makefile - tests
#
-TOP = ..
+TOP = ../src
include $(TOP)/Makefile
SRCDIR = $(top_srcdir)/tests
VPATH = $(SRCDIR) $(top_srcdir)
@@ -60,11 +60,11 @@ ifeq ($(TARGETOS),Darwin)
endif
# run local version of tcc with local libraries and includes
-TCCFLAGS = -B$(TOP) -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include -L$(TOP)
+TCCFLAGS = -B$(TOP)/../lib -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/../include -L$(TOP)
ifdef CONFIG_WIN32
- TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir) -I$(top_srcdir)/include -L$(TOP)
+ TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir) -I$(top_srcdir)/../include -L$(TOP)
endif
-XTCCFLAGS = -B$(TOP) -B$(top_srcdir)/win32 -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
+XTCCFLAGS = -B$(TOP)/../lib -B$(top_srcdir)/win32 -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/../include
TCC = $(TOP)/tcc $(TCCFLAGS)
RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(top_srcdir)/tcc.c $(TCCFLAGS)
@@ -73,7 +73,7 @@ DISAS = objdump -d
# libtcc test
ifdef LIBTCC1
- LIBTCC1:=$(TOP)/$(LIBTCC1)
+ LIBTCC1:=$(TOP)/lib/$(LIBTCC1)
endif
all test : $(TESTS)
diff --git a/tests/pp/Makefile b/tests/pp/Makefile
index c656f9a..8bbf1a7 100644
--- a/tests/pp/Makefile
+++ b/tests/pp/Makefile
@@ -2,7 +2,7 @@
# credits: 01..13.c from the pcc cpp-tests suite
#
-TCC = ../../tcc
+TCC = ../../src/tcc
TESTS = $(patsubst %.c,%.test,$(wildcard *.c))
all test : $(TESTS)
diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile
index 254fa5c..980934b 100644
--- a/tests/tests2/Makefile
+++ b/tests/tests2/Makefile
@@ -1,4 +1,4 @@
-TOP = ../..
+TOP = ../../src
include $(TOP)/Makefile
# clear CFLAGS and LDFLAGS
@@ -6,9 +6,9 @@ CFLAGS :=
LDFLAGS :=
ifdef CONFIG_WIN32
- TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
+ TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/../include -L$(TOP)
else
- TCCFLAGS = -B$(TOP) -I$(top_srcdir)/include -lm
+ TCCFLAGS = -B$(TOP)/../lib -I$(top_srcdir)/../include -lm
endif
ifeq ($(TARGETOS),Darwin)
diff --git a/win32/tools/tiny_libmaker.c b/win32/tools/tiny_libmaker.c
index 62d2a2e..62fec98 100644
--- a/win32/tools/tiny_libmaker.c
+++ b/win32/tools/tiny_libmaker.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "../../elf.h"
+#include "../../src/elf.h"
#ifdef TCC_TARGET_X86_64
# define ELFCLASSW ELFCLASS64