c - How to make a makefile? -


this question has answer here:

i trying produce simple makefile project, having trouble because still getting used them.

i have file folder containing 3 separate files, header file linkedlistapi.h, linkedlistapi.c , structlistdemo.c.

have use flags:

-wall -std=c11  

this 1 looks ok, remember replace all indentations tabs:

.phony: clean cflags:=$(cflags) -std=c11 -wall obj=./src include=./include objstringlistdemo=$(obj)/linkedlistapi.o $(obj)/stringlistdemo.o objstructlistdemo=$(obj)/linkedlistapi.o $(obj)/structlistdemo.o  all: stringlistdemo structlistdemo  stringlistdemo: $(objstringlistdemo) $(include)/linkedlistapi.h     ${cc} -o $< $@  structlistdemo: $(objstructlistdemo) $(include)/linkedlistapi.h     ${cc} -o $< $@  %.o: %.c     ${cc} $(cflags) $< -o $@  clean:     rm -rf $(objstringlistdemo) $(objstructlistdemo) stringlistdemo structlistdemo 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -