home archives github knives links
tags c makefile
categories
only title title and content
Makefile笔记

make默认只执行第一条命令

CC       := gcc
CFLAGS := -lpthread -g
TARGETS := shit
INC := $(shell find -L ./ -name "*.h")

a:
gcc a.c ${INC} $(par) ${CFLAGS} -o shit # example: make a run par="-O2"

run:
./shit

clean:
rm ./shit

fuck:
@echo $(par) # example: make fuck par="fuck you"

dump:
objdump ./shit -S > fuck

gdb:
gdb ./shit -tui

cgdb:
cgdb ./shit
SRCS    := $(shell find ./src/ -maxdepth 1 -name "*.cpp")
INC := -I./include
CFLAGS := -Wall -Werror

run:
g++ $(CFLAGS) $(INC) $(SRCS) -o md_parser
./md_parser

参数

make默认在某条命令出错而终止