blob: bfd55de25dee8d3dd26d8d910ce0a5c300f19744 (
plain) (
tree)
|
|
target := math
objs := math.o
CC := gcc
CFLAGS := -O3 -std=c99 -pedantic -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-result
all: $(target)
###
# Automatic dependency tracking
#
deps := $(patsubst %.o,%.d,$(objs))
-include $(deps)
DEPFLAGS = -MMD -MF $(@:.o=.d)
###
# Compile the program
#
$(target): $(objs)
$(CC) $(CFLAGS) -o $@ $^
%.o: src/%.c
$(CC) $(CFLAGS) -c $< $(DEPFLAGS)
###
# Phony targets
#
.PHONY: clean
clean:
rm -f $(target) $(objs) $(deps)
|