title: How can I combine two separate makefiles to compile a program?
body: <p>I have two makefiles, however, I would like to ideally have one with effects of both to compile a program (test.cpp) in Ubuntu.</p>
  
  <p>First (used for Basler Pylon5 Camera SDK):</p>
  
  <pre><code># Makefile for Basler pylon sample program
  .PHONY: all clean
  
  # The program to build
  NAME       := test
  
  # Installation directories for pylon
  PYLON_ROOT ?= /opt/pylon5
  
  # Build tools and flags
  LD         := $(CXX)
  CPPFLAGS   := $(shell $(PYLON_ROOT)/bin/pylon-config --cflags)
  CXXFLAGS   := #e.g., CXXFLAGS=-g -O0 for debugging
  LDFLAGS    := $(shell $(PYLON_ROOT)/bin/pylon-config --libs-rpath)
  LDLIBS     := $(shell $(PYLON_ROOT)/bin/pylon-config --libs)
  
  # Rules for building
  all: $(NAME)
  
  $(NAME): $(NAME).o
      $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  
  $(NAME).o: $(NAME).cpp
      $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $&lt;
  
  clean:
      $(RM) $(NAME).o $(NAME)
  </code></pre>
  
  <p>Second (used for OpenCV):</p>
  
  <pre><code># The program to build
  NAME       := test
  
  CFLAGS = `pkg-config --cflags opencv`
  LIBS = `pkg-config --libs opencv`
  
  $(NAME) : $(NAME).cpp
      g++ -o $@ $&lt; $(CFLAGS) $(LIBS) 
  </code></pre>
  
  <p>Is this possible?  I'm very new to makefiles and I'm just trying to capture and process some images with a camera.  Any help is appreciated.  Thanks.</p>