Initial commit
This commit is contained in:
39
Makefile
Normal file
39
Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
CC = gcc
|
||||
STD_CFLAGS = -Wall -std=gnu99 -c -O2
|
||||
|
||||
# Enable ARM-specific options only on ARM, and compilation of the app only on ARM
|
||||
UNAME := $(shell uname -m)
|
||||
PCPUI := $(shell cat /proc/cpuinfo | grep Revision | cut -c16-)
|
||||
|
||||
# Determine the hardware platform. Below, pi1 stands for the RaspberryPi 1 (the original one),
|
||||
# and pi2 stands for both the RaspberryPi 2 and 3.
|
||||
ifeq ($(UNAME), armv6l)
|
||||
CFLAGS = $(STD_CFLAGS) -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=1
|
||||
TARGET = pi1
|
||||
else ifeq ($(PCPUI), 11)
|
||||
CFLAGS = $(STD_CFLAGS) -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=4
|
||||
TARGET = pi4
|
||||
else ifeq ($(UNAME), armv7l)
|
||||
CFLAGS = $(STD_CFLAGS) -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=2
|
||||
TARGET = pi2
|
||||
else
|
||||
CFLAGS = $(STD_CFLAGS)
|
||||
TARGET = other
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET), other)
|
||||
|
||||
app: pitxft.o mailbox.o
|
||||
$(CC) -o pitxft mailbox.o pitxft.o -lm
|
||||
|
||||
endif
|
||||
|
||||
|
||||
mailbox.o: mailbox.c mailbox.h
|
||||
$(CC) $(CFLAGS) mailbox.c
|
||||
|
||||
pitxft.o: pitxft.c mailbox.h
|
||||
$(CC) $(CFLAGS) pitxft.c
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
Reference in New Issue
Block a user