CC=gcc
CFLAGS=-Wall -Wextra -std=gnu99 -O2 -Wno-pointer-to-int-cast
CXXFLAGS=`pkg-config opencv --cflags` -std=c++0x
LDLIBS=-lbcm2835 -lrt `pkg-config opencv --libs`
ELFS=tft_test cv_test
OBJS:=spi.o tft_test.o tft_frontend.o tft_backend.o cv_test.o
# compile and generate dependency info;
# more complicated dependency computation, so all prereqs listed
# will also become command-less, prereq-less targets
# sed: strip the target (everything before colon)
# sed: remove any continuation backslashes
# fmt -1: list words one per line
# sed: strip leading spaces
# sed: add trailing colons
%.o: %.c
gcc -c $(CFLAGS) $*.c -o $*.o
gcc -MM $(CFLAGS) $*.c > $*.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
%.o: %.cpp
g++ -c $(CXXFLAGS) $*.cpp -o $*.o
g++ -MM $(CXXFLAGS) $*.cpp > $*.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
tft_test:spi.o tft_test.o
$(CC) spi.o tft_test.o -o tft_test $(LDLIBS)
cv_test:$(OBJS)
$(CXX) $(CXXFLAGS) -o cv_test $(OBJS) $(LDLIBS)
.PHONY:clean
clean:
rm -f *.o *.s *.i $(ELFS) *.d
-