Skip to content

Commit

Permalink
linux/Makefile: Add support for cross compilation
Browse files Browse the repository at this point in the history
0. VDR`s `Makefile` was taken as a template [1].
1. Separate variables for flags for `CC` and `CXX` were introduced. `-c` is now passed explicitly. Further flags for `CXX` could be added like in VDR’s `Makefile`.
2. Separate variable `INCLUDES` defined which is only used for the libraries(?).

[1] http://git.gekrumbel.de/vdr.git?p=vdr.git;a=blob;f=Makefile;hb=bd61fee1e9328aec470c319494cccb90e53302c2
--
Please note that this is not build tested.
  • Loading branch information
paulepanter authored and signal11 committed Aug 26, 2011
1 parent 359138c commit 9b31061
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@
all: hidtest

CC?=gcc
CFLAGS?=-Wall -g
CXX?=g++
CXXFLAGS?=-Wall -g
COBJS=hid-libusb.o
CPPOBJS=../hidtest/hidtest.o
OBJS=$(COBJS) $(CPPOBJS)
CFLAGS+=-I../hidapi -Wall -g -c `pkg-config libusb-1.0 --cflags`
LIBS=`pkg-config libusb-1.0 libudev --libs`
INCLUDES?=-I../hidapi `pkg-config libusb-1.0 --cflags`


hidtest: $(OBJS)
$(CXX) -Wall -g $(LDFLAGS) $^ $(LIBS) -o hidtest
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LIBS) -o hidtest

$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@
$(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@

clean:
rm -f $(OBJS) hidtest
Expand Down

0 comments on commit 9b31061

Please sign in to comment.