Makefile now creates .so files

This commit is contained in:
2016-09-09 22:53:41 +02:00
parent db41cd547b
commit 457cc459cf
2 changed files with 20 additions and 25 deletions

View File

@@ -1,13 +1,13 @@
int setupgy521(void);
int read_i2c_word(int reg);
int read_i2c_word16(int reg);
float getTemp(void);
void setAccelerometerRange(int range);
int readAccelerometerRange(int raw);
int getAccelerometerData(char axis, int g);
void setGyroscopeRange(int range);
int readGyroscopeRange(int raw);
int getGyroscopeData(char axis);
float getAngleX(void);
float getAngleY(void);
float getAngleZ(void);
extern int setupgy521(void);
extern int read_i2c_word(int reg);
extern int read_i2c_word16(int reg);
extern float getTemp(void);
extern void setAccelerometerRange(int range);
extern int readAccelerometerRange(int raw);
extern int getAccelerometerData(char axis, int g);
extern void setGyroscopeRange(int range);
extern int readGyroscopeRange(int raw);
extern int getGyroscopeData(char axis);
extern float getAngleX(void);
extern float getAngleY(void);
extern float getAngleZ(void);

View File

@@ -1,20 +1,15 @@
#Infos: http://www.ijon.de/comp/tutorials/makefile.html
VERSION = 1.0
CC = /usr/bin/gcc
CFLAGS = -Wall -g -D_REENTRANT -DVERSION=\"$(VERSION)\"
#LDFLAGS = -lm -lpthread `gtk-config --cflags` `gtk-config --libs` -lgthread
CFLAGS = -Wall -g -D_REENTRANT -DVERSION=\"$(VERSION)\" -O3
LDFLAGS = -lwiringPi -lm
OBJ = gy521example.o libgy521.o
all: lib test
libgy521: $(OBJ)
$(CC) $(CFLAGS) -o gy521example $(OBJ) $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c $<
lib: libgy521.o
cc -shared -o libgy521.so libgy521.o -lm -lwiringPi
test: gy521example.o
cc -o test -L. gy521example.o -lgy521 -lwiringPi
.PHONY: clean
clean:
rm -r *.o