#/***************************************************************************
#*   Copyright (C) 2021                                                  *
#*   NET GmbH                                                      		   *
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU General Public License as published by  *
#*   the Free Software Foundation; either version 2 of the License, or     *
#*   (at your option) any later version.                                   *
#*                                                                         *
#*   This program is distributed in the hope that it will be useful,       *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU General Public License for more details.                          *
#*                                                                         *
#*   You should have received a copy of the GNU General Public License     *
#*   along with this program; if not, write to the                         *
#*   Free Software Foundation, Inc.,                                       *
#*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
#***************************************************************************/

PROJECT   =   iCubeUVC_HID

CXX       :=   g++
OBJ       :=   main.o ICubeHID.o ICubeHID_Interface.o chid.o


# linking libraries
LDFLAGS   += -lpthread 

CUR_DIR =   $(shell pwd)
SRC     =   $(CUR_DIR)/src
BUILD   =   $(CUR_DIR)/build
VPATH   =   $(SRC)


CFLAGS :=   -O2 -Wall -Wpointer-arith 

.PHONY: all clean

all: $(BUILD) $(PROJECT)

$(PROJECT) : $(OBJ)
	$(CXX) $(CFLAGS) $(addprefix $(BUILD)/, $^)  -o $@ $(LDFLAGS)

%.o : %.cpp
	$(CXX) -c $(CFLAGS) $< -o $(BUILD)/$@

clean:
	$(RM) -rf $(BUILD)/*.o $(BUILD)
	$(RM) $(PROJECT)

$(BUILD) :
	-mkdir -p $@
