Browse Source

Replace Makefile with build.sh

rexim 4 years ago
parent
commit
774e18b567
4 changed files with 19 additions and 11 deletions
  1. 3 3
      .github/workflows/ci.yml
  2. 0 7
      Makefile
  3. 1 1
      README.md
  4. 15 0
      build.sh

+ 3 - 3
.github/workflows/ci.yml

@@ -15,7 +15,7 @@ jobs:
           sudo apt-get install -qq libsdl2-dev libglew-dev
       - name: build te
         run: |
-          make
+          ./build.sh
         env:
           CC: gcc
   build-linux-clang:
@@ -28,7 +28,7 @@ jobs:
           sudo apt-get install -qq libsdl2-dev libglew-dev
       - name: build te
         run: |
-          make
+          ./build.sh
         env:
           CC: clang
   build-macos:
@@ -39,7 +39,7 @@ jobs:
         run: brew install sdl2 pkg-config glew
       - name: build te
         run: |
-          make
+          ./build.sh
         env:
           CC: clang
   build-windows-msvc:

+ 0 - 7
Makefile

@@ -1,7 +0,0 @@
-PKGS=sdl2 glew
-CFLAGS=-Wall -Wextra -std=c11 -pedantic -ggdb `pkg-config --cflags $(PKGS)`
-LIBS=`pkg-config --libs $(PKGS)` -lm
-SRCS=src/main.c src/la.c src/editor.c src/font.c src/sdl_extra.c src/file.c src/gl_extra.c
-
-te: $(SRCS)
-	$(CC) $(CFLAGS) -o te $(SRCS) $(LIBS)

+ 1 - 1
README.md

@@ -3,6 +3,6 @@
 # Quick Start
 
 ```console
-$ make
+$ ./build.sh
 $ ./te main.c
 ```

+ 15 - 0
build.sh

@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -xe
+
+CC="${CXX:-cc}"
+PKGS="sdl2 glew"
+CFLAGS="-Wall -Wextra -std=c11 -pedantic -ggdb"
+LIBS=-lm
+SRC="src/main.c src/la.c src/editor.c src/font.c src/sdl_extra.c src/file.c src/gl_extra.c"
+
+if [ `uname` = "Darwin" ]; then
+    CFLAGS+=" -framework OpenGL"
+fi
+
+$CC $CFLAGS `pkg-config --cflags $PKGS` -o te $SRC $LIBS `pkg-config --libs $PKGS`