-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·64 lines (48 loc) · 1.43 KB
/
Makefile
File metadata and controls
executable file
·64 lines (48 loc) · 1.43 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#define all stuffs needed to compile
OUTPUT_DIR=$(BR_DIR)/output
HOST_DIR=$(OUTPUT_DIR)/host
COMPILER_NAME=arm-linux-
CC=$(HOST_DIR)/usr/bin/$(COMPILER_NAME)gcc
AR=$(HOST_DIR)/usr/bin/$(COMPILER_NAME)ar
PREFIX=$(OUTPUT_DIR)/target/usr/lib
PYTHON_ENABLED=$(shell grep '^BR2_PACKAGE_PYTHON3=' $(BR_DIR)/.config | cut -d= -f2)
ifeq ($(PYTHON_ENABLED),y)
PYTHON_VERS=$(shell grep "^PYTHON3_VERSION_MAJOR" $(BR_DIR)/package/python3/python3.mk | \
cut -d= -f2 | sed 's/[[:space:]]*//g')
endif
CFLAGS+=-g -W -Wall -I. -I$(OSCIMP_DIGITAL_DRIVER)
LDFLAGS=-lm
SRC= $(wildcard *.c)
OBJS= $(SRC:.c=.o)
LIB_NAME=liboscimp_fpga
#distant device ip
IP?=192.168.0.10
all: $(LIB_NAME).so $(LIB_NAME)_static.a
$(LIB_NAME).so: $(OBJS)
$(CC) -shared -o $@ $^ $(LDFLAGS)
$(LIB_NAME)_static.a: $(OBJS)
$(AR) rcs -o $@ $^
# $@ left side of :
%.o: %.c %.h
$(CC) $(CFLAGS) -fpic -o $@ -c $<
clean:
rm -rf $(OBJS)
rm -f $(LIB_NAME).so
rm -f $(LIB_NAME)_static.a
rm -f *.c~ *.h~ Makefile~
ifneq ($(PYTHON_ENABLED),y)
install: all
cp -f $(LIB_NAME).so $(PREFIX)
install_ssh: all
scp -O $(LIB_NAME).so root@$(IP):/usr/lib
else
install: all
cp -f $(LIB_NAME).so $(PREFIX)
cp -f $(LIB_NAME).py $(PREFIX)/python$(PYTHON_VERS)/site-packages
install_ssh: all
scp -O $(LIB_NAME).so root@$(IP):/usr/lib
scp -O $(LIB_NAME).py root@$(IP):/usr/lib/python$(PYTHON_VERS)/site-packages
endif
uninstall: clean
rm -f $(PREFIX)/$(LIB_NAME).so
.PHONY: clean install uninstall