Comments (2)
Вот пример заготовки Makefile, которая весь мусор в директорию mk сбрасывает:
run make DEF=...
to add extra defines
PROGRAM :=
LDFLAGS := -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--discard-all
SRCS := $(wildcard *.c)
DEFINES := $(DEF) -D_XOPEN_SOURCE=1111
OBJDIR := mk
CFLAGS += -O2 -Wall -Werror -Wextra -Wno-trampolines -std=gnu99
OBJS :=
DEPS := $(OBJS:.o=.d)
CC = gcc
#CXX = g++
all :
@echo -e "\t\tLD $(PROGRAM)"
$(OBJDIR):
mkdir $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPS)
endif
$(OBJDIR)/%.o: %.c
@echo -e "\t\tCC $<"
clean:
@echo -e "\t\tCLEAN"
@rm -f
@rmdir $(OBJDIR) 2>/dev/null || true
xclean: clean
@rm -f $(PROGRAM)
gentags:
CFLAGS="$(CFLAGS)
.PHONY: gentags clean xclean
from stm8_samples.
Спасибо это помогло.И вот что получилось
#Makefile for stm8 sdcc project
NAME=testproj
SDCC=sdcc
INCLUDES=-I../ -I/usr/share/sdcc/include
DEFINES=-D STM8S103
CCFLAGS= -mstm8 --out-fmt-ihx
LDFLAGS= -mstm8 --out-fmt-ihx -lstm8
FLASHFLAGS=-c stlinkv2 -p stm8s103f3
OBJDIR=build
SRC=$(wildcard *.c)
OBJS= $(addprefix $(OBJDIR)/,$(SRC:%.c=%.rel))
all: $(OBJDIR) $(NAME).ihx
$(OBJDIR):
mkdir $(OBJDIR)
clean:
rm -Rrf $(OBJDIR)
flash: $(NAME).ihx
stm8flash $(FLASHFLAGS) -w $(OBJDIR)/$(NAME).ihx
$(OBJDIR)/%.rel: %.c
$(SDCC) $(CCFLAGS) $(INCLUDES) $(DEFINES) -o $@ -c $<
$(NAME).ihx: $(OBJS)
$(SDCC) $(LDFLAGS) $(OBJS) -o $(OBJDIR)/$(NAME).ihx
.PHONY: all
from stm8_samples.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stm8_samples.