-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (42 loc) · 1.22 KB
/
Makefile
File metadata and controls
51 lines (42 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
PLAT=$(shell uname -s)
include Make.rules.$(PLAT)
override CFLAGS+= -Wall -std=c99 -pedantic
INCLUDES=gpioapi.h
MAJOR_VERS=1
MINOR_VERS=0
LIB_NAME=libgpio.$(SO_EXT).$(MAJOR_VERS).$(MINOR_VERS)
ifeq ($(TARGET),arm)
#CC_PATH=/home/polysat/Code/polysat_linux/build-tools/buildroot/output/staging/usr
CC=$(ARM_TOOLCHAIN_PATH)/$(ARM_BIN_SUBPATH)cc
STRIP=$(ARM_TOOLCHAIN_PATH)/$(ARM_BIN_SUBPATH)strip
LIB_PATH=$(ARM_TOOLCHAIN_PATH)/lib
INC_PATH=$(ARM_TOOLCHAIN_PATH)/include
else
LIB_PATH=/usr/lib
INC_PATH=/usr/include
BIN_PATH=/usr/bin
STRIP=strip
SBIN_PATH=/usr/sbin
endif
all: gpiotest $(LIB_NAME)
arm: TARGET=arm
arm: all
gpiotest: gpiotest.o $(LIB_NAME)
$(CC) $(LDFLAGS) -L. -o $@ gpiotest.o -lgpio
$(STRIP) $@
gpioapi.o: override CFLAGS += $(SO_CFLAGS)
$(LIB_NAME): gpioapi.o
$(CC) $(SO_LDFLAGS) $(LDFLAGS) $< -o $@
$(STRIP) $@
ln -sf $(LIB_NAME) libgpio.$(SO_EXT)
ln -sf $(LIB_NAME) libgpio.$(SO_EXT).$(MINOR_VERS)
install: gpiotest $(LIB_NAME)
cp $(LIB_NAME) $(LIB_PATH)
ln -sf $(LIB_NAME) $(LIB_PATH)/libgpio.$(SO_EXT)
ln -sf $(LIB_NAME) $(LIB_PATH)/libgpio.$(SO_EXT).$(MAJOR_VERS)
install -d $(INC_PATH)
cp $(INCLUDES) $(INC_PATH)
cp gpiotest $(BIN_PATH)
.PHONY: clean
clean:
rm -rf core* *.o gpiotest libgpio.*