57 lines
2.1 KiB
Makefile
57 lines
2.1 KiB
Makefile
|
DTSNAME = BB-BONE-IRMUX
|
||
|
DTSFILE = $(DTSNAME)-00A0.dts
|
||
|
|
||
|
LIB_PATH = .
|
||
|
LIBRARIES = pthread prussdrv glib-2.0
|
||
|
INCLUDES = . include /usr/include/glib-2.0 /usr/lib/glib-2.0/include
|
||
|
OBJ_PATH = obj/
|
||
|
SRC_PATH = src/
|
||
|
TARGET_PATH = bin/
|
||
|
|
||
|
CC = $(CROSS_COMPILE)gcc
|
||
|
PASM = pasm
|
||
|
|
||
|
all: directories pinmux stop rawtiming read_signal ircommander
|
||
|
|
||
|
# Dit target is voor het automatisch instellen van debug-variabelen.
|
||
|
debug:
|
||
|
make CFLAGS=-DDEBUG PFLAGS=-DDEBUG DTSNAME=BB-BONE-IRDEBUG all
|
||
|
|
||
|
directories:
|
||
|
mkdir -p $(OBJ_PATH) $(TARGET_PATH)
|
||
|
|
||
|
authkeys:
|
||
|
ssh-keygen -t rsa
|
||
|
ssh $(SSHHOST) mkdir -p .ssh
|
||
|
cat ~/.ssh/id_rsa.pub | ssh $(SSHHOST) 'cat >> .ssh/authorized_keys'
|
||
|
|
||
|
# De target (linkerhand) zou een resulterend bestand moeten zijn zodat make kan
|
||
|
# controleren of er opnieuw gecompileerd moet worden.
|
||
|
# Nu worden alles telkens gecompileerd.
|
||
|
pinmux: $(SRC_PATH)$(DTSFILE)
|
||
|
dtc -O dtb -o $(OBJ_PATH)$(DTSFILE:%.dts=%.dtbo) -b 0 -@ $(SRC_PATH)$(DTSFILE)
|
||
|
cp $(OBJ_PATH)$(DTSFILE:%.dts=%.dtbo) /lib/firmware
|
||
|
|
||
|
stop: $(SRC_PATH)stop.c
|
||
|
$(CC) $(INCLUDES:%=-I%) $(CFLAGS) -c -o $(OBJ_PATH)$@.o $(SRC_PATH)$@.c
|
||
|
$(CC) $(OBJ_PATH)$@.o $(LIB_PATH:%=-L%) $(LIBRARIES:%=-l%) -o $(TARGET_PATH)$@
|
||
|
|
||
|
rawtiming: $(SRC_PATH)rawtiming.c $(SRC_PATH)rawtiming.p
|
||
|
$(PASM) $(PFLAGS) -b $(SRC_PATH)$@.p $(TARGET_PATH)$@
|
||
|
$(CC) $(INCLUDES:%=-I%) $(CFLAGS) -c -o $(OBJ_PATH)$@.o $(SRC_PATH)$@.c
|
||
|
$(CC) $(OBJ_PATH)$@.o $(LIB_PATH:%=-L%) $(LIBRARIES:%=-l%) -o $(TARGET_PATH)$@
|
||
|
|
||
|
read_signal: $(SRC_PATH)read_signal.c $(SRC_PATH)read_signal.p
|
||
|
$(PASM) $(PFLAGS) -b $(SRC_PATH)$@.p $(TARGET_PATH)$@
|
||
|
$(CC) $(INCLUDES:%=-I%) $(CFLAGS) -c -o $(OBJ_PATH)$@.o $(SRC_PATH)$@.c
|
||
|
$(CC) $(OBJ_PATH)$@.o $(LIB_PATH:%=-L%) $(LIBRARIES:%=-l%) -o $(TARGET_PATH)$@
|
||
|
|
||
|
ircommander: $(SRC_PATH)ircommander.c $(SRC_PATH)ircommander.p
|
||
|
$(PASM) $(PFLAGS) -b $(SRC_PATH)$@.p $(TARGET_PATH)$@
|
||
|
$(CC) $(INCLUDES:%=-I%) $(CFLAGS) -c -o $(OBJ_PATH)$@.o $(SRC_PATH)$@.c
|
||
|
$(CC) $(OBJ_PATH)$@.o $(LIB_PATH:%=-L%) $(LIBRARIES:%=-l%) -o $(TARGET_PATH)$@
|
||
|
|
||
|
clean:
|
||
|
# verwijder de root-slash uit het pad voor het geval een gebruiker dom bezig is
|
||
|
rm -rf $(OBJ_PATH:/%=%) $(TARGET_PATH:/%=%)
|