commit | author | age
|
cfdcbd
|
1 |
#********************************************************************************* |
G |
2 |
# Copyright: (C) 2022 Guo Wenxue |
|
3 |
# All rights reserved. |
|
4 |
# |
|
5 |
# Filename: Makefile |
|
6 |
# Description: This Makefile used to compile all the C source code file in current |
|
7 |
# folder to respective excutable binary files. |
|
8 |
# |
|
9 |
# Version: 1.0.0(03/15/2022~) |
|
10 |
# Author: Guo Wenxue <guowenxue@gmail.com> |
|
11 |
# ChangeLog: 1, Release initial version on "03/15/2022 01:29:33 PM" |
|
12 |
# |
|
13 |
#********************************************************************************/ |
|
14 |
|
|
15 |
PWD=$(shell pwd) |
|
16 |
LIB_PATH=$(shell dirname ${PWD}) |
|
17 |
LIB_NAME=$(shell basename ${LIB_PATH}) |
|
18 |
INSTPATH=/tftp |
|
19 |
|
|
20 |
#ARCH ?= i386 |
|
21 |
#ARCH?=arm926t |
|
22 |
ARCH?=arm920t |
|
23 |
|
|
24 |
#LINK_MODE=STATIC |
|
25 |
MODE=PRODUCTION |
|
26 |
DEBUG=1 |
|
27 |
|
|
28 |
INSTPATH=/tftp |
|
29 |
|
|
30 |
#CROSS_COMPILE=aarch64-linux-gnu- |
|
31 |
|
|
32 |
export CC=${CROSS_COMPILE}gcc |
|
33 |
export CXX=${CROSS_COMPILE}g++ |
|
34 |
export AR=${CROSS_COMPILE}ar |
|
35 |
export AS=${CROSS_COMPILE}as |
|
36 |
export RANLIB=${CROSS_COMPILE}ranlib |
|
37 |
export STRIP=${CROSS_COMPILE}strip |
|
38 |
|
|
39 |
SRCS = $(wildcard ${VPATH}/*.c) |
|
40 |
OBJS = $(patsubst %.c,%.o,$(SRCS)) |
|
41 |
|
|
42 |
SRCFILES = $(wildcard *.c) |
|
43 |
BINARIES=$(SRCFILES:%.c=%) |
|
44 |
|
|
45 |
CFLAGS+=-I${LIB_PATH} |
|
46 |
LDFLAGS+=-L${LIB_PATH} -l${LIB_NAME} |
|
47 |
|
|
48 |
all: binaries install |
|
49 |
|
|
50 |
binaries: ${BINARIES} |
|
51 |
|
|
52 |
%: %.c |
|
53 |
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) |
|
54 |
|
|
55 |
install: |
|
56 |
cp $(BINARIES) ${INSTPATH} |
|
57 |
|
|
58 |
clean: |
|
59 |
@rm -f *.o *.lo $(BINARIES) |
|
60 |
|
|
61 |
distclean: clean |
|
62 |
@rm -f tags cscope* |
|
63 |
|
|
64 |
.PHONY: clean entry |