avatar

松果工作室

欢迎光临

  • 首页
  • freeRTOS
  • ESP
  • 开发手册
  • 快速笔记
  • 个人收藏
  • 工具
Home Makefile 文件的编写
文章

Makefile 文件的编写

Posted 2024-04-30 Updated 2024-04- 30
By YCP
3~4 min read

例子

#交叉编译工具链绝对路径,去掉首个 / 为相对路径
CC = /root/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc

#编译目标文件
APP = myLn

#主函数入口文件
SOURCES = myLn.c

#头文件相对路径  
DEPENDS = 	Components/one.h \
			Components/two.h \
			Components/aes.h \
			Components/gps.h \
			Components/tcp.h \
			Components/data_process.h \
			Components/i2c_bmx055.h
#头文件目标文件相对路径
OBJS = 	Components/one.o \
		Components/two.o \
		Components/aes.o \
		Components/gps.o \
		Components/tcp.o \
		Components/data_process.o\
		Components/i2c_bmx055.o
#-I 后加相对头文件路径
INCLUDES = -IComponents

#动态链接库
LIBS	  = -lm -lpthread -ldl
CFLAGS = -std=c99

#[可执行文件]包括 :[头文件] [头文件编译目标] [主函数文件]
$(APP) :  $(DEPENDS) $(OBJS) $(SOURCES)

#用[GCC工具链] 把[主函数文件]编译成[可执行文件APP],同时应用[CFLAGS][CFLAGS][LIBS][INCLUDES][INCLUDES][OBJS]
$(CC) $(SOURCES) -o $(APP) $(CFLAGS) $(LIBS) $(INCLUDES) $(OBJS) 

PHONY: all clean
all: $(APP)

clean:
	rm -rf $(APP)
	rm -rf *.o Components/*.o
坑和笔记
Linux
License:  CC BY 4.0
Share

Further Reading

Dec 23, 2024

其他笔记

EC800K AT连接移远云 配置过程 # 配置产品信息(初次连接需配置) AT+QIOTCFG="productinfo","pxxxxt","cDVTxxxxxxxxWGVB" # 连接开发者中心 AT+QIOTREG=1 # 查询当前连接状态(+QIOTSTATE: 8为正常) AT+QI

Jun 21, 2024

环形滤波算法

#include <stdio.h> #include <stdlib.h> #define BUFFER_SIZE 10 // 缓冲区大小 #define THRESHOLD 180

Jun 17, 2024

STM32 ADC采集的三种方式

采样周期 单个采集模式 ADC_Settings: 程序使用 uint16_t ADC_Read(

OLDER

少年晶体管收音机(二)能选电台的收音机

NEWER

少年晶体管收音机(三)有一级低频放大的晶体管收音机

Recently Updated

  • ESP32(八) 简单的webserver
  • ESP32(七) NVS
  • ESP32(四) STA & AP
  • 多级菜单
  • ESP32(五) ESP32 OTA

Trending Tags

WCH Linux Elec freeRTOS STM ESP Flutter Others SwiftUI

Contents

©2025 松果工作室. Some rights reserved.

Using the Halo theme Chirpy