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); extern int setupgy521(void);
int read_i2c_word(int reg); extern int read_i2c_word(int reg);
int read_i2c_word16(int reg); extern int read_i2c_word16(int reg);
float getTemp(void); extern float getTemp(void);
void setAccelerometerRange(int range); extern void setAccelerometerRange(int range);
int readAccelerometerRange(int raw); extern int readAccelerometerRange(int raw);
int getAccelerometerData(char axis, int g); extern int getAccelerometerData(char axis, int g);
void setGyroscopeRange(int range); extern void setGyroscopeRange(int range);
int readGyroscopeRange(int raw); extern int readGyroscopeRange(int raw);
int getGyroscopeData(char axis); extern int getGyroscopeData(char axis);
float getAngleX(void); extern float getAngleX(void);
float getAngleY(void); extern float getAngleY(void);
float getAngleZ(void); extern float getAngleZ(void);

View File

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