guowenxue
2024-06-02 eaa90c75a6b4981dbbb15e3ebf851c056bf015c9
commit | author | age
1e563e 1
G 2 # Cross compiler
3 CROSS_COMPILE=arm-linux-gnueabihf-
4 CC=${CROSS_COMPILE}gcc
5 AR=${CROSS_COMPILE}ar
6
7 # libgpiod compile install path
8 LIBGPIOD_PATH=libgpiod/install
9
10 # compile flags and link flags
11 CFLAGS+=-I ${LIBGPIOD_PATH}/include
12 LDFLAGS+=-L ${LIBGPIOD_PATH}/lib -lgpiod
13
14 INSTALL_BINS=can_test
15
16 all: libs
17     ${CC} hello.c -o hello
18     ${CC} ${CFLAGS} leds.c -o leds ${LDFLAGS}
19     ${CC} keypad.c -o keypad
20     ${CC} ds18b20.c -o ds18b20
21     ${CC} pwm.c -o pwm
22     ${CC} pwm_play.c -o pwm_play
23     ${CC} sht20_fops.c -o sht20_fops
24     ${CC} sht20_ioctl.c -o sht20_ioctl
25     ${CC} spi_test.c -o spi_test
26     ${CC} ttyS_test.c -o ttyS_test -lpthread
27     ${CC} can_test.c -o can_test
28     @make install
29
30 libs:
31     make -C libgpiod CROSS_COMPILE=${CROSS_COMPILE}
32
33 clean:
34     @rm -f hello
35     @rm -f leds 
36     @rm -f keypad
37     @rm -f ds18b20
38     @rm -f pwm 
39     @rm -f pwm_play
40     @rm -f sht20_fops
41     @rm -f sht20_ioctl
42     @rm -f spi_test
43     @rm -f ttyS_test
44     @rm -f can_test
45
46 distclean: clean
47     make clean -C libgpiod
48
49 install:
50     cp ${INSTALL_BINS} /tftp