RaspberrPi project source code
Guo Wenxue
2024-12-29 8517494b239d652ea9a24457faa13f88f55979b9
commit | author | age
d6b4a7 1 #********************************************************************************
G 2 #      Copyright:  (C) 2023 LingYun IoT System Studio
3 #                  All rights reserved.
4 #
5 #       Filename:  Makefile
6 #    Description:  This file used to compile all the C file to respective binary,
7 #                  and it will auto detect cross compile or local compile.
8 #
9 #        Version:  1.0.0(11/08/23)
10 #         Author:  Guo Wenxue <guowenxue@gmail.com>
11 #      ChangeLog:  1, Release initial version on "11/08/23 16:18:43"
12 #
13 #*******************************************************************************
14
01a9d8 15 PWD=$(shell pwd)
G 16 TOPDIR=${PWD}/../project/
17 OPENLIBS_INCPATH=${TOPDIR}/openlibs/install/include
18 OPENLIBS_LIBPATH=${TOPDIR}/openlibs/install/lib
d6b4a7 19
G 20 BUILD_ARCH=$(shell uname -m)
21 ifneq ($(findstring $(BUILD_ARCH), "x86_64" "i386"),)
22     CROSS_COMPILE?=arm-linux-gnueabihf-
23 endif
24
25 CC=${CROSS_COMPILE}gcc
26
01a9d8 27 CFLAGS+=-I${OPENLIBS_INCPATH}
G 28 LDFLAGS+=-L${OPENLIBS_LIBPATH} -lm -lgpiod
d6b4a7 29
G 30 SRCFILES = $(wildcard *.c)
31 BINARIES=$(SRCFILES:%.c=%)
32
33 all: ${BINARIES}
34
35 %: %.c 
36     $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
37
38 clean:
39     rm -f ${BINARIES}