+++ /dev/null
-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
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'
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