From 47e06c6d4e542e47fcbad69a78c2436a854a0779 Mon Sep 17 00:00:00 2001 From: gus knight Date: Mon, 27 Jul 2015 16:03:25 -0400 Subject: [PATCH] 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... --- .gitignore | 4 +-- CMakeLists.txt | 51 +++++++++++++-------------- configure | 8 ++--- Changelog => docs/Changelog | 0 CodingStyle.md => docs/CodingStyle.md | 0 TODO => docs/TODO | 0 config.texi.in => docs/config.texi.in | 0 tcc-doc.texi => docs/tcc-doc.texi | 0 texi2pod.pl => docs/texi2pod.pl | 0 lib/Makefile | 16 ++++----- Makefile => src/Makefile | 42 +++++++++++----------- arm-gen.c => src/arm/arm-gen.c | 2 +- arm64-gen.c => src/arm/arm64-gen.c | 2 +- il-gen.c => src/cil/il-gen.c | 0 il-opcodes.h => src/cil/il-opcodes.h | 0 coff.h => src/coff.h | 0 config.h.in => src/config.h.in | 0 conftest.c => src/conftest.c | 0 elf.h => src/elf.h | 0 libtcc.c => src/libtcc.c | 12 +++---- libtcc.h => src/libtcc.h | 0 stab.def => src/stab.def | 0 stab.h => src/stab.h | 0 tcc.c => src/tcc.c | 0 tcc.h => src/tcc.h | 10 +++--- tccasm.c => src/tccasm.c | 0 tcccoff.c => src/tcccoff.c | 0 tccelf.c => src/tccelf.c | 2 +- tccgen.c => src/tccgen.c | 0 tcclib.h => src/tcclib.h | 0 tccpe.c => src/tccpe.c | 2 +- tccpp.c => src/tccpp.c | 0 tccrun.c => src/tccrun.c | 0 tcctok.h => src/tcctok.h | 2 +- c67-gen.c => src/tms320c67/c67-gen.c | 2 +- i386-asm.c => src/x86/i386-asm.c | 2 +- i386-asm.h => src/x86/i386-asm.h | 0 i386-gen.c => src/x86/i386-gen.c | 2 +- i386-tok.h => src/x86/i386-tok.h | 0 x86_64-asm.h => src/x86/x86_64-asm.h | 0 x86_64-gen.c => src/x86/x86_64-gen.c | 2 +- tests/Makefile | 10 +++--- tests/pp/Makefile | 2 +- tests/tests2/Makefile | 6 ++-- win32/tools/tiny_libmaker.c | 2 +- 45 files changed, 90 insertions(+), 91 deletions(-) rename Changelog => docs/Changelog (100%) rename CodingStyle.md => docs/CodingStyle.md (100%) rename TODO => docs/TODO (100%) rename config.texi.in => docs/config.texi.in (100%) rename tcc-doc.texi => docs/tcc-doc.texi (100%) rename texi2pod.pl => docs/texi2pod.pl (100%) mode change 100755 => 100644 rename Makefile => src/Makefile (92%) rename arm-gen.c => src/arm/arm-gen.c (99%) rename arm64-gen.c => src/arm/arm64-gen.c (99%) rename il-gen.c => src/cil/il-gen.c (100%) rename il-opcodes.h => src/cil/il-opcodes.h (100%) rename coff.h => src/coff.h (100%) rename config.h.in => src/config.h.in (100%) rename conftest.c => src/conftest.c (100%) rename elf.h => src/elf.h (100%) rename libtcc.c => src/libtcc.c (99%) rename libtcc.h => src/libtcc.h (100%) rename stab.def => src/stab.def (100%) rename stab.h => src/stab.h (100%) rename tcc.c => src/tcc.c (100%) rename tcc.h => src/tcc.h (99%) rename tccasm.c => src/tccasm.c (100%) rename tcccoff.c => src/tcccoff.c (100%) rename tccelf.c => src/tccelf.c (99%) rename tccgen.c => src/tccgen.c (100%) rename tcclib.h => src/tcclib.h (100%) rename tccpe.c => src/tccpe.c (99%) rename tccpp.c => src/tccpp.c (100%) rename tccrun.c => src/tccrun.c (100%) rename tcctok.h => src/tcctok.h (99%) rename c67-gen.c => src/tms320c67/c67-gen.c (99%) rename i386-asm.c => src/x86/i386-asm.c (99%) rename i386-asm.h => src/x86/i386-asm.h (100%) rename i386-gen.c => src/x86/i386-gen.c (99%) rename i386-tok.h => src/x86/i386-tok.h (100%) rename x86_64-asm.h => src/x86/x86_64-asm.h (100%) rename x86_64-gen.c => src/x86/x86_64-gen.c (99%) diff --git a/.gitignore b/.gitignore index 1aff332c..48f59c49 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 effa22dd..50a9f843 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 31213301..f00a6b6f 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 similarity index 100% rename from Changelog rename to docs/Changelog diff --git a/CodingStyle.md b/docs/CodingStyle.md similarity index 100% rename from CodingStyle.md rename to docs/CodingStyle.md diff --git a/TODO b/docs/TODO similarity index 100% rename from TODO rename to docs/TODO diff --git a/config.texi.in b/docs/config.texi.in similarity index 100% rename from config.texi.in rename to docs/config.texi.in diff --git a/tcc-doc.texi b/docs/tcc-doc.texi similarity index 100% rename from tcc-doc.texi rename to docs/tcc-doc.texi diff --git a/texi2pod.pl b/docs/texi2pod.pl old mode 100755 new mode 100644 similarity index 100% rename from texi2pod.pl rename to docs/texi2pod.pl diff --git a/lib/Makefile b/lib/Makefile index 348cb721..e747b98c 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 similarity index 92% rename from Makefile rename to src/Makefile index 20459789..a098a76f 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 similarity index 99% rename from arm-gen.c rename to src/arm/arm-gen.c index ddb3917d..f31fb882 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 similarity index 99% rename from arm64-gen.c rename to src/arm/arm64-gen.c index 62447e7c..fe3d7aa4 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 ST_DATA const int reg_classes[NB_REGS] = { diff --git a/il-gen.c b/src/cil/il-gen.c similarity index 100% rename from il-gen.c rename to src/cil/il-gen.c diff --git a/il-opcodes.h b/src/cil/il-opcodes.h similarity index 100% rename from il-opcodes.h rename to src/cil/il-opcodes.h diff --git a/coff.h b/src/coff.h similarity index 100% rename from coff.h rename to src/coff.h diff --git a/config.h.in b/src/config.h.in similarity index 100% rename from config.h.in rename to src/config.h.in diff --git a/conftest.c b/src/conftest.c similarity index 100% rename from conftest.c rename to src/conftest.c diff --git a/elf.h b/src/elf.h similarity index 100% rename from elf.h rename to src/elf.h diff --git a/libtcc.c b/src/libtcc.c similarity index 99% rename from libtcc.c rename to src/libtcc.c index f4f01c26..f6002802 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 similarity index 100% rename from libtcc.h rename to src/libtcc.h diff --git a/stab.def b/src/stab.def similarity index 100% rename from stab.def rename to src/stab.def diff --git a/stab.h b/src/stab.h similarity index 100% rename from stab.h rename to src/stab.h diff --git a/tcc.c b/src/tcc.c similarity index 100% rename from tcc.c rename to src/tcc.c diff --git a/tcc.h b/src/tcc.h similarity index 99% rename from tcc.h rename to src/tcc.h index 5fa6ba41..eb0365d2 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 similarity index 100% rename from tccasm.c rename to src/tccasm.c diff --git a/tcccoff.c b/src/tcccoff.c similarity index 100% rename from tcccoff.c rename to src/tcccoff.c diff --git a/tccelf.c b/src/tccelf.c similarity index 99% rename from tccelf.c rename to src/tccelf.c index 507b598b..d00faddf 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 similarity index 100% rename from tccgen.c rename to src/tccgen.c diff --git a/tcclib.h b/src/tcclib.h similarity index 100% rename from tcclib.h rename to src/tcclib.h diff --git a/tccpe.c b/src/tccpe.c similarity index 99% rename from tccpe.c rename to src/tccpe.c index a13eac77..479d084e 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 similarity index 100% rename from tccpp.c rename to src/tccpp.c diff --git a/tccrun.c b/src/tccrun.c similarity index 100% rename from tccrun.c rename to src/tccrun.c diff --git a/tcctok.h b/src/tcctok.h similarity index 99% rename from tcctok.h rename to src/tcctok.h index 7372f518..5972fd60 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 similarity index 99% rename from c67-gen.c rename to src/tms320c67/c67-gen.c index 88bfbb43..84ff78c8 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 similarity index 99% rename from i386-asm.c rename to src/x86/i386-asm.c index fd320bd2..adc40b2f 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 similarity index 100% rename from i386-asm.h rename to src/x86/i386-asm.h diff --git a/i386-gen.c b/src/x86/i386-gen.c similarity index 99% rename from i386-gen.c rename to src/x86/i386-gen.c index 81826bd2..b8b12aa3 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 similarity index 100% rename from i386-tok.h rename to src/x86/i386-tok.h diff --git a/x86_64-asm.h b/src/x86/x86_64-asm.h similarity index 100% rename from x86_64-asm.h rename to src/x86/x86_64-asm.h diff --git a/x86_64-gen.c b/src/x86/x86_64-gen.c similarity index 99% rename from x86_64-gen.c rename to src/x86/x86_64-gen.c index 4a486041..0ce58464 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 ST_DATA const int reg_classes[NB_REGS] = { diff --git a/tests/Makefile b/tests/Makefile index 270eaa71..f83027ff 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 c656f9a8..8bbf1a75 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 254fa5ca..980934b9 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 62d2a2e0..62fec98e 100644 --- a/win32/tools/tiny_libmaker.c +++ b/win32/tools/tiny_libmaker.c @@ -21,7 +21,7 @@ #include #include #include -#include "../../elf.h" +#include "../../src/elf.h" #ifdef TCC_TARGET_X86_64 # define ELFCLASSW ELFCLASS64