1
0
ssd1306_linux/Makefile

26 lines
518 B
Makefile
Raw Normal View History

2020-02-13 04:55:42 +02:00
CC=gcc
2023-05-31 01:06:04 +03:00
CFLAGS=-I ./ -Wall -Werror
2020-02-13 04:55:42 +02:00
LDFLAGS=-static
OBJS=main.o ssd1306.o linux_i2c.o
BIN=ssd1306_bin
default: $(BIN)
.PHONY: default clean
# Adapted from scottmcpeak.com/autodepend/autodepend.html
-include $(OBJS:.o=.d)
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $*.o
$(CC) -MM $(CFLAGS) $< > $*.d
@cp -f $*.d $*.d.tmp
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
2020-02-13 04:55:42 +02:00
$(BIN):$(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
clean:
rm -f *.o *.d $(BIN)
2020-02-13 04:55:42 +02:00