-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathlib.Makefile
More file actions
38 lines (29 loc) · 859 Bytes
/
lib.Makefile
File metadata and controls
38 lines (29 loc) · 859 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
CROSS_COMPILER:= arm-hisiv100nptl-linux-
CC:=$(CROSS_COMPILER)g++
GCC:=$(CROSS_COMPILER)gcc
AR:=$(CROSS_COMPILER)ar
CFLAGS:= -Wall -Werror -fpic -O2 -fno-strict-aliasing #-lstdc++
LIB = -static -lpthread -L.
LIBOBJ_DIR=$(PROJECT_ROOT)/$(TARGET)
SRC +=$(wildcard $(LIBOBJ_DIR)/*.cpp)
SRC +=$(wildcard $(LIBOBJ_DIR)/*.c)
OBJ = $(SRC:%.cpp=%.o)
LIBSET_DIR=$(PROJECT_ROOT)/lib
OBJ_DIR=$(PROJECT_ROOT)/objects
OBJ_LIB=$(addprefix $(LIBOBJ_DIR)/, $(addsuffix .o, $(basename $(notdir $(SRC)))))
LIBNAME := $(join lib,$(addsuffix .a,$(TARGET)))
.PHONY:all
all: $(OBJ) lib
$(OBJ): %.o:%.cpp
$(CC) $(CFLAGS) -c -o $@ $< $(INCLUDE)
.PHONY:lib
lib: $(OBJ)
$(AR) -rcu $(LIBNAME) $(OBJ)
cp $(LIBOBJ_DIR)/$(LIBNAME) $(LIBSET_DIR)
echo $(LIBOBJ_DIR)
echo $(OBJ_DIR)
cp $(LIBOBJ_DIR)/*.o $(OBJ_DIR)
.PHONY:clean
clean:
rm -f $(LIBNAME)
rm -f $(OBJ)