Skip to content

Commit

Permalink
Merge pull request #12 from authmillenon/better-make
Browse files Browse the repository at this point in the history
Utilize build system better
  • Loading branch information
tobyjaffey committed Feb 3, 2015
2 parents d55c536 + bb128ef commit 9cb1dcd
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Makefile
@@ -1,5 +1,21 @@
all:
gcc -Wall -o coap endpoints.c main-posix.c coap.c -DDEBUG
CFLAGS += -Wall -DDEBUG
SRC = $(wildcard *.c)
OBJ = $(SRC:%.c=%.o)
DEPS = $(SRC:%.c=%.d)
EXEC = coap

all: $(EXEC)

-include $(DEPS)

$(EXEC): $(OBJ)
@$(CC) $(CFLAGS) -o $@ $^

%.o: %.c %.d
@$(CC) -c $(CFLAGS) -o $@ $<

%.d: %.c
@$(CC) -MM $(CFLAGS) $< > $@

clean:
rm -f coap
@$(RM) $(EXEC) $(OBJ) $(DEPS)

0 comments on commit 9cb1dcd

Please sign in to comment.