From bdd105ab4853bc1726c94a66d34a38f943870b28 Mon Sep 17 00:00:00 2001 From: Jonathan Moallem Date: Tue, 24 Nov 2020 17:16:35 +1100 Subject: [PATCH] Removed test target from Makefile and updated workflows accordingly --- .github/workflows/macOS.yml | 14 +++++--------- .github/workflows/ubuntu.yml | 14 +++++--------- .gitignore | 3 +-- Makefile | 36 +++++++++++++++--------------------- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 5bf6f86..dfdfbaa 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -8,17 +8,13 @@ on: branches: [ main ] jobs: - build: + compile: runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: make setup run: make setup - - name: make test - run: make test - - name: save logs as artifact - if: ${{ failure() }} - uses: actions/upload-artifact@v2 - with: - name: logs - path: .temp/execute.log + - name: make compile + run: make compile + - name: make clean + run: make clean \ No newline at end of file diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 1a6d9a7..6c94a55 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -8,7 +8,7 @@ on: branches: [ main ] jobs: - build: + compile: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,11 +18,7 @@ jobs: run: sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev - name: make setup run: make setup - - name: make test - run: make test - - name: save logs as artifact - if: ${{ failure() }} - uses: actions/upload-artifact@v2 - with: - name: logs - path: .temp/execute.log + - name: make compile + run: make compile + - name: make clean + run: make clean \ No newline at end of file diff --git a/.gitignore b/.gitignore index 28a491d..8908f5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ include lib -build -.temp \ No newline at end of file +build \ No newline at end of file diff --git a/Makefile b/Makefile index 59b4c38..3ab49bc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ # Set general macros buildFile = build/app -tempDir = .temp # Check for Windows ifeq ($(OS), Windows_NT) @@ -31,52 +30,47 @@ else # Set UNIX commands mkdirOptions = -p - cleanCommand = rm $(buildFile); rm -rf $(tempDir) + cleanCommand = rm $(buildFile) endif +# Default target, compiles, executes and cleans run: compile execute clean -setup: include lib +# Lists phony targets for Make compile .PHONY: run setup pull compile execute clean -test: compile execute check clean +# Sets up the project for compiling, creates libs and includes +setup: include lib +# Pull and update the the build submodules pull: - # Pull and update the the build submodules git submodule init; git submodule update cd vendor/raylib-cpp; git submodule init; git submodule update +# Copy the relevant header files into includes include: pull - # Copy the relevant header files into includes mkdir $(mkdirOptions) include cp vendor/raylib-cpp/vendor/raylib/src/raylib.h include/raylib.h cp vendor/raylib-cpp/vendor/raylib/src/raymath.h include/raymath.h cp vendor/raylib-cpp/include/*.hpp include +# Build the raylib static library file and copy it into lib lib: pull - # Build the raylib static library file and copy it into lib cd vendor/raylib-cpp/vendor/raylib/src; make PLATFORM=PLATFORM_DESKTOP mkdir $(mkdirOptions) lib/$(platform) cp vendor/raylib-cpp/vendor/raylib/$(libGenDirectory)/libraylib.a lib/$(platform)/libraylib.a -compile: - # Create the build folder and compile the executable +build: mkdir $(mkdirOptions) build + +# Create the build folder and compile the executable +compile: build $(compiler) -std=c++17 -I include -L lib/$(platform) src/main.cpp -o $(buildFile) -l raylib $(options) +# Run the executable execute: - # Run the executable and push the output to a log file - mkdir $(mkdirOptions) $(tempDir) - $(buildFile) | tee $(tempDir)/execute.log + $(buildFile) +# Clean up all relevant files clean: - # Clean up all relevant files $(cleanCommand) - -check: - # Search the execution log for mention of raylib starting - $(eval VAR = $(shell grep -c "raylib" $(tempDir)/execute.log)) - if [ $(VAR) -gt 0 ];\ - then echo "Application was started";\ - else echo "Application failed to start"; exit 1;\ - fi