Skip to content

Commit

Permalink
Merge pull request #131 from davidgiven/fixing
Browse files Browse the repository at this point in the history
Debug builds are now debuggable.
  • Loading branch information
davidgiven authored Jan 27, 2020
2 parents c4ef488 + efd74e0 commit 6087228
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: apt
run: sudo apt install libusb-1.0-0-dev libsqlite3-dev ninja-build
- name: make
Expand All @@ -16,6 +18,8 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: brew
run: brew install sqlite pkg-config libusb ninja
- name: make
Expand All @@ -26,9 +30,12 @@ jobs:
# steps:
# - uses: numworks/setup-msys2@v1
# with:
# msystem: MSYS
# path-type: inherit
# - uses: actions/checkout@v1
# - name: pacman
# run: msys2do pacman -S --noconfirm --needed make ninja mingw-w64-i686-libusb mingw-w64-i686-sqlite3 mingw-w64-i686-zlib mingw-w64-i686-gcc zip
# - name: make
# run: msys2do make
# run: |
# msys2do pacman -S --noconfirm --needed make ninja mingw-w64-i686-libusb mingw-w64-i686-sqlite3 mingw-w64-i686-zlib mingw-w64-i686-gcc zip
# - name: build
# run: |
# msys2do make

11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
PACKAGES = zlib sqlite3 libusb-1.0

export CFLAGS = -Os -g --std=c++14 \
-ffunction-sections -fdata-sections
export LDFLAGS = -Os
export CFLAGS = --std=c++14 -ffunction-sections -fdata-sections
export LDFLAGS =

export COPTFLAGS = -Os
export LDOPTFLAGS = -Os -s

export CDBGFLAGS = -O0 -g
export LDDBGFLAGS = -O0 -g

ifeq ($(OS), Windows_NT)
export CXX = /mingw32/bin/g++
Expand Down
38 changes: 26 additions & 12 deletions mkninja.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,27 @@ buildlibrary() {
esac
done

local objs
objs=
local oobjs
local dobjs
oobjs=
dobjs=
for src in "$@"; do
local obj
obj="$OBJDIR/${src%%.c*}.o"
objs="$objs $obj"
obj="$OBJDIR/opt/${src%%.c*}.o"
oobjs="$oobjs $obj"

echo build $obj : cxx $src
echo " flags=$flags"
echo " flags=$flags $COPTFLAGS"

obj="$OBJDIR/dbg/${src%%.c*}.o"
dobjs="$dobjs $obj"

echo build $obj : cxx $src
echo " flags=$flags $CDBGFLAGS"
done

echo build $OBJDIR/$lib : library $objs
echo build $OBJDIR/opt/$lib : library $oobjs
echo build $OBJDIR/dbg/$lib : library $dobjs
}

buildprogram() {
Expand All @@ -77,16 +86,21 @@ buildprogram() {
esac
done

local objs
objs=
local oobjs
local dobjs
oobjs=
dobjs=
for src in "$@"; do
objs="$objs $OBJDIR/$src"
oobjs="$oobjs $OBJDIR/opt/$src"
dobjs="$dobjs $OBJDIR/dbg/$src"
done

echo build $prog-debug$EXTENSION : link $objs
echo " flags=$flags"
echo build $prog-debug$EXTENSION : link $dobjs
echo " flags=$flags $LDDBGFLAGS"

echo build $prog$EXTENSION : link $oobjs
echo " flags=$flags $LDOPTFLAGS"

echo build $prog$EXTENSION : strip $prog-debug$EXTENSION
}

buildsimpleprogram() {
Expand Down

0 comments on commit 6087228

Please sign in to comment.