Skip to content

Commit d5db621

Browse files
cortecciaAlexeyBulatov
authored andcommitted
C++: all: Makefile: fixes for cross-compilation
Makefile's target for dependencies was added and all of the pigpio relations in Makefiles were changed. Now it can be easily compiled or cross-compiled with all dependencies by running only "make".
1 parent 30c1038 commit d5db621

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

C++/Examples/RCInput/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
CXX ?= g++
22
NAVIO = ../../Navio
33

4-
PIGPIO_PATH := $(PIGPIO_PATH)
4+
PIGPIO_PATH ?= $(NAVIO)/pigpio
55

66
LIB = -L$(PIGPIO_PATH)
77

88
INCLUDES = -I ../../Navio -I$(PIGPIO_PATH)
99

1010
all:
1111
$(MAKE) -C ../../Navio all
12-
$(CXX) -std=gnu++11 $(INCLUDES) $(LIB) RCInput.cpp -L$(NAVIO) -lnavio -o RCInput -lrt -lpthread -lpigpio || $(MAKE) pigpio
12+
$(CXX) -std=gnu++11 $(INCLUDES) $(LIB) RCInput.cpp -L$(NAVIO) -lnavio -o RCInput -lrt -lpthread -lpigpio
1313

1414
clean:
1515
rm -f RCInput

C++/Navio/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
CXX ?= g++
2-
CFLAGS = -std=c++11 -Wno-psabi -c -I .
2+
PIGPIO_PATH ?= pigpio
3+
CFLAGS = -std=c++11 -Wno-psabi -c -I . -I$(PIGPIO_PATH)
34

45
SRC=$(wildcard */*.cpp)
56
OBJECTS = $(SRC:.cpp=.o)
67

78
%.o: %.cpp
89
$(CXX) $(CFLAGS) -o $@ $<
910

10-
all: $(OBJECTS)
11+
.PHONY: get_deps clean
12+
13+
all: get_deps $(OBJECTS)
1114
ar rcs libnavio.a $(OBJECTS)
1215

16+
get_deps:
17+
bash get_dependencies.sh
18+
1319
clean:
1420
rm -f */*.o *.a
21+
$(MAKE) -C pigpio clean

0 commit comments

Comments
 (0)