Skip to content

Commit

Permalink
C library build and install make targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed May 27, 2019
1 parent 2abcc25 commit 580086d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ test-c:
-o detools.no-crle.o
$(CC) $(CFLAGS) $(C_SOURCES) -llzma -o main
./main
$(MAKE) -C src/c library
$(MAKE) -C src/c
src/c/detools apply_patch tests/files/foo/old tests/files/foo/patch foo.new
cmp foo.new tests/files/foo/new
Expand Down
2 changes: 1 addition & 1 deletion detools/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.28.0'
__version__ = '0.29.0'
22 changes: 17 additions & 5 deletions src/c/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ifeq ($(origin CC), default)
CC = gcc
endif
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar

# Install prefix.
PREFIX ?= /usr/local

CFLAGS := \
-Wall \
Expand All @@ -10,8 +12,8 @@ CFLAGS := \
-Wformat=2 \
-Wshadow \
-Werror \
-Wpedantic \
-std=c99
-std=c99 \
-O2

SRC := \
heatshrink/heatshrink_decoder.c \
Expand All @@ -20,3 +22,13 @@ SRC := \

all:
$(CC) $(CFLAGS) $(SRC) -llzma -o detools

library:
$(CC) $(CFLAGS) detools.c -c -o detools.o
$(AR) cr libdetools.a detools.o

install:
mkdir -p $(PREFIX)/include
install -c -m 644 detools.h $(PREFIX)/include
mkdir -p $(PREFIX)/lib
install -c -m 644 libdetools.a $(PREFIX)/lib

0 comments on commit 580086d

Please sign in to comment.