-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
39 lines (27 loc) · 856 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
PROJECT_NAME = nrf24le1
PROJECT_PATH = $(pwd)
CC = gcc
INCLUDE = -I/usr/local/include -I.
CFLAGS = -O3 -Wall $(INCLUDE) -Winline -pipe $(CFLAGSDEV)
LDFLAGS = -L/usr/local/lib
LIBS = -l bcm2835 -l rt
SRC = main.c wiring.c nrf24le1.c
OBJ = $(addprefix $(OBJ_PATH)/, $(patsubst %.c,%.o,$(SRC)))
BINS = main
BIN_PATH = bin
OBJ_PATH = obj
all: $(BIN_PATH)/$(PROJECT_NAME)
$(BIN_PATH)/nrf24le1: $(OBJ)
@mkdir -p $(BIN_PATH)
$(CC) -o $(BIN_PATH)/$(PROJECT_NAME) $(OBJ) $(LDFLAGS) $(LIBS)
$(OBJ_PATH)/%.o: %.c
@mkdir -p $(OBJ_PATH)
$(CC) -c -o $@ $< $(CFLAGS)
$(OBJ_PATH)/wiring.o: wiring.c wiring.h
$(OBJ_PATH)/nrf24le1.o: wiring.h nrf24le1.h
$(OBJ_PATH)/main.o: nrf24le1.h
install:
install -m 06777 $(BIN_PATH)/$(PROJECT_NAME) /usr/local/bin/$(PROJECT_NAME)
clean:
rm -f $(OBJ_PATH)/* $(BIN_PATH)/*
.PHONY: all clean install