-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 892 Bytes
/
Makefile
File metadata and controls
37 lines (30 loc) · 892 Bytes
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
DIR_INC := ./inc
DIR_SRC := ./src
DIR_OBJ := ./obj
DIR_LIB := ./lib
TARGET := example.out
TARGET_OBJ := $(DIR_OBJ)/$(TARGET)
CC := gcc
CFLAGS := -I $(DIR_INC)
SRC := $(wildcard $(DIR_SRC)/*.c)
OBJ := $(patsubst %.c, $(DIR_OBJ)/%.o, $(notdir $(SRC)))
$(TARGET_OBJ) : $(OBJ)
$(CC) $^ -o $@
$(DIR_OBJ)/%.o : $(DIR_SRC)/%.c
$(CC) $< -c $(CFLAGS) -o $@
.PHONY : lib
lib :
gcc $(DIR_SRC)/find_usbdevice.c -fPIC -shared $(CFLAGS) -o $(DIR_LIB)/libfind_usbdev.so
arm-linux-gnueabihf-gcc $(DIR_SRC)/find_usbdevice.c -fPIC -shared $(CFLAGS) -o $(DIR_LIB)/libfind_usbdev_arm.so
aarch64-linux-gnu-gcc $(DIR_SRC)/find_usbdevice.c -fPIC -shared $(CFLAGS) -o $(DIR_LIB)/libfind_usbdev_arm64.so
ar crv $(DIR_LIB)/libfind_usbdev.a $(DIR_OBJ)/find_usbdevice.o
.PHONY : debug
debug :
@echo $(SRC)
@echo $(OBJ)
@echo $(TARGET)
@echo $(TARGET_OBJ)
.PHONY : clean
clean :
-rm ./lib/*
-rm ./obj/*