I am trying to write my own makefile for small project, my project consists of src directory that contains main.c, file1.c, file2.c, header1.h, and finally header2.h these files use some library from non standard libraries directory that I have created and non standard header file, the libraries directory is located in usr/lib/pr__lib and the header directory is located in usr/include/lib so I should create two makefile.am one will be located in src directory and the other one will be in root directory of the project the makefile.am of the src directory is as shown below:
program_NAME := myproject
AM_CPPFLAGS = \
-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\"
bin_PROGRAMS = myproject_AutoProject
program_INCLUDE_DIRS := /usr/bin/srr__bin
program_LIBRARY_DIRS := /usr/lib/srr__lib
AM_CFLAGS =
AM_CFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
program_lib2 := \
libsrr\
libprdsl \
libtwo \
libhistogram \
libhistogram_pic \
libprlistofarrays \
libprlistofarrays_pic \
libprmalloc \
libvreo
AM_LDFLAGS =
AM_LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))
AM_LDFLAGS += $(foreach library,$(program_lib2),-l$(library))
PRDSL_AutoProject_SOURCES = \
main.c \
file1.c \
file2.c
depend :
makedepend -$(CFLAGS) -$(PRDSL_AutoProject_SOURCES)
all: $(program_NAME)
the second makefile.am is as shown below:
SUBDIRS = src
myproject_AutoProjectdocdir = ${prefix}/doc/PRDSL_AutoProject
myproject_AutoProjectdoc_DATA = \
README\
COPYING\
AUTHORS\
ChangeLog\
INSTALL\
NEWS
INTLTOOL_FILES = intltool-extract.in \
intltool-merge.in \
intltool-update.in
EXTRA_DIST = $(myproject_AutoProjectdoc_DATA) \
$(INTLTOOL_FILES)
DISTCLEANFILES = intltool-extract \
intltool-merge \
intltool-update \
po/.intltool-merge-cache
# Remove doc directory on uninstall
uninstall-local:
-rm -r $(PRDSL_AutoProjectdocdir)
but i have received the below error:
/usr/bin/ld: cannot find -llibsrr
/usr/bin/ld:.......
and the same for the rest of the libraries! I guess that the problem in the depend command here, can anyone tell me how to use the depend command in order to create the dependency automatically and avoid human errors