Makefile.amのサンプル
/project/Makefile.am
SUBDIRS = src src2

/project/src/Makefile.am
noinst_PROGRAMS = main1
noinst_LIBRARIES = libclass.a

main1_SOURCES = main1.cpp libclass.a
libclass_a_SOURCES = myclass.cpp

/project/src/main1.cpp
#include <iostream>
#include "myclass.h"

int main(void)
{
  MyClass o(10);
  cout << o.getx() << endl;
  return 0;
}

/project/src/myclass.h
#ifndef __MYCLASS_H__
#define __MYCLASS_H__

class MyClass{
  int x;
public:
  MyClass(int i=0);
  int getx(void);
};

#endif /* __MYCLASS_H__ */

/project/src/myclass.cpp
#include "myclass.h"

MyClass::MyClass(int i=0){
  x=i;
}
int MyClass::getx(void)
{
  return x;
}

/project/src2/Makefile.am
noinst_PROGRAMS = main2

main2_SOURCES = main2.cpp
LDADD = ../1/libclass.a

/project/src2/main2.cpp
#include <iostream>
#include "../1/myclass.h"

int main(void)
{
  MyClass o(20);
  cout << o.getx() << endl;
  return 0;
}