Skip to content

Commit

Permalink
Merge pull request #2 from silvio/sfr/update-make-files
Browse files Browse the repository at this point in the history
makefiles a bit more compliant
  • Loading branch information
swedishborgie authored Jul 15, 2020
2 parents 59e9e40 + 52f5afc commit 6238ae0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
CC=gcc
CFLAGS=-fPIC
CFLAGS_SHARED=-shared
CC?=gcc
CFLAGS?=-fPIC
CFLAGS_SHARED?=-shared
OBJ=mma8451.o
LIBNAME=libmma8451.so
HEADER=mma8451.h
TESTOBJ=mma8451-test.o
TESTNAME=mma8451-test

Expand All @@ -11,8 +12,10 @@ all: compile
compile: $(LIBNAME) $(TESTNAME)

install: $(LIBNAME)
cp $(LIBNAME) /usr/lib/$(LIBNAME)
cp $(TESTNAME) /usr/bin/$(TESTNAME)
install -d 0755 ${DESTDIR}/usr/lib $(DESTDIR)/usr/bin $(DESTDIR)/usr/include/mma8451
install -m 0644 $(LIBNAME) $(DESTDIR)/usr/lib/$(LIBNAME)
install -m 0644 $(TESTNAME) $(DESTDIR)/usr/bin/$(TESTNAME)
install -m 0644 $(HEADER) $(DESTDIR)/usr/include/mma8451/$(HEADER)

fix-i2c:
echo -n 1 > /sys/module/i2c_bcm2708/parameters/combined
Expand All @@ -24,7 +27,7 @@ clean:
$(CC) -c -o $@ $< $(CFLAGS)

$(LIBNAME): $(OBJ)
gcc -o $@ $^ $(CFLAGS) $(CFLAGS_SHARED)
$(CC) -o $@ $^ $(CFLAGS) $(CFLAGS_SHARED)

$(TESTNAME): $(LIBNAME) $(TESTOBJ)
gcc -o $@ $^ $(CFLAGS) -L. -lmma8451
$(CC) -o $@ $^ $(CFLAGS) -L. -lmma8451

0 comments on commit 6238ae0

Please sign in to comment.