wirelessgateway/Makefile

72 lines
1.8 KiB
Makefile

TARGET = Cidn-SH
OBJ_PATH = $(shell pwd)/debug
PREFIX_BIN =
CC = arm-linux-gnueabihf-g++
STRIP = arm-linux-gnueabihf-strip
INCLUDES = -I../third_party/boost/include \
-I../third_party/fftw/include \
-I../third_party/jsoncpp/include \
-I../third_party/sqlite/include/
LIBS = -L../third_party/boost/lib \
-L../third_party/fftw/lib \
-L../third_party/ssl/lib \
-L../third_party/jsoncpp \
-L../third_party/mqtt1410/lib \
-L../third_party/sqlite/lib \
-lsqlite3 -lboost_system -lpthread -lboost_thread -lboost_date_time -lfftw3 -lssl -lcrypto -ljson -lmosquitto
CFLAGS = -O2 #-Wall -Werror
LINKFLAGS =
AllDirs :=$(shell ls -R | grep '^\./.*:' | awk '{if( \
substr($$1,3,5) != "debug") {gsub(":",""); print}}') .
Sources := $(foreach n,$(AllDirs) , $(wildcard $(n)/*.cpp))
#C_SOURCES = $(wildcard *.c)
C_SRCDIR = $(AllDirs)
C_SOURCES = $(foreach d,$(C_SRCDIR),$(wildcard $(d)/*.c) )
C_OBJS = $(patsubst %.c, $(OBJ_PATH)/%.o, $(C_SOURCES))
#CPP_SOURCES = $(wildcard *.cpp)
CPP_SRCDIR = $(AllDirs)
CPP_SOURCES = $(foreach d,$(CPP_SRCDIR),$(wildcard $(d)/*.cpp) )
CPP_OBJS = $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(CPP_SOURCES))
default:init compile strip
$(C_OBJS):$(OBJ_PATH)/%.o:%.c
$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@
$(CPP_OBJS):$(OBJ_PATH)/%.o:%.cpp
$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@
init:
$(foreach d,$(AllDirs), mkdir -p $(OBJ_PATH)/$(d);)
test:
@echo "C_SOURCES: $(C_SOURCES)"
@echo "C_OBJS: $(C_OBJS)"
@echo "CPP_SOURCES: $(CPP_SOURCES)"
@echo "CPP_OBJS: $(CPP_OBJS)"
compile:$(C_OBJS) $(CPP_OBJS)
$(CC) -O2 -o $(TARGET) $^ $(LINKFLAGS) $(LIBS)
clean:
rm -rf $(OBJ_PATH)
rm -f $(TARGET)
install: $(TARGET)
cp $(TARGET) $(PREFIX_BIN)
uninstall:
rm -f $(PREFIX_BIN)/$(TARGET)
strip:
$(STRIP) $(TARGET)
cp $(TARGET) ~/tftpboot
rebuild: clean compile