Skip to content

Commit

Permalink
Fixed issue SRA-VJTI#136 - Updated Makefile of 6_morphology
Browse files Browse the repository at this point in the history
  • Loading branch information
hssagare committed Feb 18, 2025
1 parent 6f958fb commit 09d3ab0
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions 4_cv_basics/6_morphology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@ PROJECT = morphology

# Here Include specifies which directories can be added in the include path of the main.cpp
CFLAGS = -std=c++11 $(shell pkg-config --cflags opencv4) -Iinclude/
# What libraries to be imported here it is opencv
# What libraries to be imported here it is opencv
LIBS = $(shell pkg-config --libs opencv4)

# Similar to how we used to link ad make object files in the terminal
# the command make build <subfolder name> should build the executable
# Source file for morphology operations
link = src/morphology.cpp

# Similar to how we used to link and make object files in the terminal
# The command make build SRC=<FILENAME> should build the executable in the subfolder
.PHONY: build
ifeq ($(SRC), $(link), )
build:
$(error "SRC is not set")
else
build:
@echo "Building..."
@$(CC) $(filter-out $@,$(MAKECMDGOALS))/main.cpp $(link) -o _$(filter-out $@,$(MAKECMDGOALS)) $(CFLAGS) $(LIBS)
%::
@true
# if folder is not set, clean all build files all subfolders
@$(CC) $(SRC) $(link) -o $(PROJECT) $(CFLAGS) $(LIBS)
endif

# If folder is not set, clean all build files in all subfolders
.PHONY: clean
clean:
@echo "Cleaning..."
@rm -rf _$(filter-out $@,$(MAKECMDGOALS))
@rm -rf $(PROJECT)

0 comments on commit 09d3ab0

Please sign in to comment.