From: Brendan Hansen Date: Tue, 5 Jan 2021 02:16:44 +0000 (-0600) Subject: removed old Makefile; just use build.sh or build.bat X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=fc21308d7d4abaf80a8dc54fa5942260f4060ce5;p=onyx.git removed old Makefile; just use build.sh or build.bat --- diff --git a/.github/workflows/onyx-build.yml b/.github/workflows/onyx-build.yml index 7d197358..9f35b692 100644 --- a/.github/workflows/onyx-build.yml +++ b/.github/workflows/onyx-build.yml @@ -13,9 +13,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: add build folder - run: mkdir build - - name: make - run: make + - name: build onyx + run: ./build.sh - name: run tests run: ./bin/test diff --git a/Makefile b/Makefile deleted file mode 100644 index 59c1bd30..00000000 --- a/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -RELEASE=1 -USE_GCC=1 - -OBJ_FILES=\ - build/onyxlex.o \ - build/onyxparser.o \ - build/onyxclone.o \ - build/onyxtypes.o \ - build/onyxbuiltins.o \ - build/onyxentities.o \ - build/onyxsempass.o \ - build/onyxsymres.o \ - build/onyxchecker.o \ - build/onyxerrors.o \ - build/onyxutils.o \ - build/onyxwasm.o \ - build/onyxdoc.o \ - build/onyx.o - -ifeq (, $(shell which tcc)) - CC=gcc -else -ifeq ($(RELEASE), 0) - CC=gcc -else - ifeq ($(USE_GCC),1) - CC=gcc - else - CC=tcc - endif -endif -endif - -INCLUDES=-I./include -LIBS= -TARGET=./bin/onyx - -# These aren't working yet -INSTALL_FOLDER=/usr/share/onyx -DEFINES=-DCORE_INSTALLATION=$(INSTALL_FOLDER) - -ifeq ($(RELEASE), 1) - FLAGS=-O3 -else - FLAGS=-g3 -endif - -build/%.o: src/%.c include/bh.h - $(CC) $(TIMEFLAG) $(FLAGS) -c $< -o $@ $(INCLUDES) - -$(TARGET): $(OBJ_FILES) - $(CC) $(TIMEFLAG) $(FLAGS) $(OBJ_FILES) -o $@ $(LIBS) - -install: $(TARGET) core/* - cp $(TARGET) /usr/bin/ - cp -r core/ $(INSTALL_FOLDER)/ - -install_syntax: misc/onyx.vim misc/onyx.sublime-syntax - cp ./misc/onyx_compiler.vim /usr/share/vim/vim82/compiler/onyx.vim - cp ./misc/onyx.vim /usr/share/vim/vim82/syntax/onyx.vim - cp ./misc/onyx.sublime-syntax /home/brendan/.config/sublime-text-3/Packages/User/onyx.sublime-syntax - cp ./misc/onyx.sublime-build /home/brendan/.config/sublime-text-3/Packages/User/Onyx.sublime-build - -clean: - rm -f $(OBJ_FILES) 2>&1 >/dev/null - -all: onyx diff --git a/bin/onyx b/bin/onyx index 1d3b6254..ad7094df 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/build.sh b/build.sh index bbde6c6d..4a5dbed9 100644 --- a/build.sh +++ b/build.sh @@ -7,22 +7,24 @@ CC='gcc' WARNINGS='-Wimplicit -Wmisleading-indentation -Wmultistatement-macros -Wparentheses -Wsequence-point -Wreturn-type -Wshift-negative-value -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wmaybe-uninitialized -Wsign-compare -Wstrict-overflow -Wduplicated-branches -Wduplicated-cond -Wtrigraphs -Waddress -Wlogical-op' if [ "$1" = "debug" ]; then - FLAGS='-g3 -I./include' + FLAGS="$WARNINGS -g3 -I./include" else FLAGS="$WARNINGS -O3 -I./include" fi -BUILD_DIR='./build' +BUILD_DIR='.' mkdir -p "$BUILD_DIR" for file in $C_FILES ; do echo "Compiling $file.c" - $CC -o build/$file.o $FLAGS -c src/$file.c + $CC -o $BUILD_DIR/$file.o $FLAGS -c src/$file.c done -ALL_FILES="$(for file in $C_FILES ; do printf "$BUILD_DIR/%s.o " $file ; done)" echo "Linking $TARGET" -$CC -o $TARGET $FLAGS $ALL_FILES +$CC -o $TARGET $FLAGS $(for file in $C_FILES ; do printf "$BUILD_DIR/%s.o " $file ; done) + +echo "Removing object files" +for file in $C_FILES ; do rm -f "$BUILD_DIR/$file".o 2>/dev/null ; done echo "Installing onyx executable" BIN_DIR='/usr/bin' @@ -33,6 +35,5 @@ CORE_DIR='/usr/share/onyx' sudo mkdir -p "$CORE_DIR" sudo cp -r ./core/ "$CORE_DIR" - # Otherwise the prompt ends on the same line printf "\n" \ No newline at end of file