Skip to content

Commit

Permalink
Utilize build system better
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Feb 3, 2015
1 parent 6fc9b1a commit bb128ef
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 bb128ef

Please sign in to comment.