X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=Makefile;h=9eb3c79455603e54d50f92f9a83d0b38863ab052;hb=b416f18295f7edcb5474396a6b26a59fd5ddb1f5;hp=d3185636f5a9d2aa285760d135cd9c87520f4dc7;hpb=71843db5886f60d3959d966a5e062a516c24798e;p=smdp.git diff --git a/Makefile b/Makefile index d318563..9eb3c79 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,30 @@ -# set some compiler flags -CFLAGS=-lncurses - -# find *.c in the current directory -SOURCES=$(wildcard *.c) -TESTS=$(wildcard test/*.c) - -# define the output objects by replacing .c with .o -TARGETS=$(SOURCES:.c=) -TEST_TARGETS=$(TESTS:.c=) - -# this will make all objects -all: $(TEST_TARGETS) $(TARGETS) -test: $(TEST_TARGETS) - -# each objects will be build by a *.c file -#%.o: %.c -%: %.c - cc $(CFLAGS) -o $@ $^ - -# this will delete all objects -# if not all objects are there, they will be compiled first -clean: $(TARGETS) $(TEST_TARGETS) - rm -f $^ +CFLAGS=-g -Wall + +mdp: mdp.c cstring.o cstack.o markdown.o parser.o viewer.o + cc $(CFLAGS) -o mdp mdp.c cstring.o cstack.o markdown.o parser.o viewer.o -lncurses + +viewer.o: viewer.c + cc $(CFLAGS) -c viewer.c + +parser.o: parser.c + cc $(CFLAGS) -c parser.c + +markdown.o: markdown.c + cc $(CFLAGS) -c markdown.c + +cstack.o: cstack.c + cc $(CFLAGS) -c cstack.c + +cstring.o: cstring.c + cc $(CFLAGS) -c cstring.c + +all: mdp + +clean: + rm -f mdp *.o + +.PHONY: test + +test: + $(MAKE) -C test