LingYun Studio embeded system framwork software, such as thirdparty build shell and lingyun library
guowenxue
2024-10-29 ba226d945dd784aa21c70584c464a11e890d2b90
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
52
53
54
55
56
#*********************************************************************************
#      Copyright:  (C) 2022 Guo Wenxue
#                  All rights reserved.
#
#       Filename:  Makefile
#    Description:  This Makefile used to compile all the C source code file in current
#                  folder to respective excutable binary files.
#
#        Version:  1.0.0(03/15/2022~)
#                  Author:  Guo Wenxue <guowenxue@gmail.com>
#      ChangeLog:  1, Release initial version on "03/15/2022 01:29:33 PM"
#
#********************************************************************************/
 
PWD=$(shell pwd)
INSTPATH=/tftp
 
ARCH?=x86
 
ifeq ($(ARCH), arm)
    CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
else ifeq ($(ARCH), arm64)
    CROSS_COMPILE=/opt/gcc-aarch64-10.3-2021.07/bin/aarch64-none-linux-gnu-
endif
 
CC=${CROSS_COMPILE}gcc
 
LIB_PATH=$(shell dirname ${PWD})
LIB_NAME=$(shell basename ${LIB_PATH})
 
SRCS = $(wildcard ${VPATH}/*.c)
OBJS = $(patsubst %.c,%.o,$(SRCS))
 
SRCFILES = $(wildcard *.c)
BINARIES=$(SRCFILES:%.c=%)
 
CFLAGS+=-I${LIB_PATH}
LDFLAGS+=-L${LIB_PATH} -l${LIB_NAME}
 
all: binaries install
 
binaries:  ${BINARIES}
 
%:  %.c
    $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
 
install:
    cp $(BINARIES) ${INSTPATH}
 
clean:
    @rm -f *.o *.log $(BINARIES)
 
distclean: clean
    @rm -f  tags cscope*
 
.PHONY: clean entry