making the Makefile of rApache gives me errors - makefile

Apologize in advance, I am a newbie in Linux and these stuffs.
I have to install rApache 1.2.0, but when I write on the terminal:
make -f ~/Makefile.am
it gives me many errors, such as:
make: *** No rule to make target "mod_R.h", needed by "mod_R.so".
or
make: *** No rule to make target "#DOCROOT#/httpd.conf.in", needed by "#DOCROOT#/httpd.conf".
Here is the Makefile.am (link):
# DARWIN has to be different than everyone else
# and define their autoconf $shlibpath_var to be DYLD_LIBRARY_PATH
SHLIBPATH_VAR=#SHLIBPATH_VAR#
ACLOCAL_AMFLAGS = -I m4
APXS=#APXS#
HTTPD=#HTTPD#
DOCROOT=#DOCROOT#
APREQ=#APREQ#
APREQ_COMPILE=#APREQ_COMPILE#
APREQ_INSTALL=#APREQ_INSTALL#
APREQ_CLEAN=#APREQ_CLEAN#
APREQ_LIB_DIR=#APREQ_LIB_DIR#
APREQ_INCLUDES=#APREQ_INCLUDES#
APREQ_LINKLD=#APREQ_LINKLD#
RPROG=#RPROG#
RPROGBATCH=R_DEFAULT_PACKAGES=NULL #RPROG# --vanilla --no-readline --slave -f
R_HOME = `$(RPROG) RHOME`
R_LD_LIBRARY_PATH = $(R_HOME)/lib
RINCLUDES=#RINCLUDES#
RLINKLD=#RLINKLD#
INCLUDES = $(RINCLUDES) $(APREQ_INCLUDES)
LDFLAGS = $(RLINKLD) $(APREQ_LINKLD)
LD_LIBRARY_PATH=$(R_LD_LIBRARY_PATH):$(APREQ_LIB_DIR)
RPATH=#RPATH#
all: mod_R.so $(DOCROOT)/httpd.conf
mod_R.so: .apreq-config mod_R.c mod_R.h
#echo
#echo Compiling mod_R
#echo
$(APXS) $(INCLUDES) -c mod_R.c $(RPATH) $(LDFLAGS)
.apreq-config:
#echo
#echo Configuring libapreq2
#echo
$(APREQ_COMPILE)
touch .apreq-config
install: all
$(APXS) -i -n R mod_R.la
$(APREQ_INSTALL)
$(DOCROOT)/httpd.conf: $(DOCROOT)/httpd.conf.in
$(RPROGBATCH) tools/config_http.R --args $(APXS) $(HTTPD)
itest: all
#echo
#echo Point your browser to http://localhost:8181/index.html
#echo
$(SHLIBPATH_VAR)=$(LD_LIBRARY_PATH) R_HOME=$(R_HOME) $(HTTPD) -X -f $(DOCROOT)/httpd.conf
test: all $(DOCROOT)/httpd.conf
stop: all
$(SHLIBPATH_VAR)=$(LD_LIBRARY_PATH) R_HOME=$(R_HOME) $(HTTPD) -X -f $(DOCROOT)/httpd.conf -k stop
valgrind: all
$(SHLIBPATH_VAR)=$(LD_LIBRARY_PATH) R_HOME=$(R_HOME) valgrind $(HTTPD) -X -f $(DOCROOT)/httpd.conf
debug: all
#echo
#echo Copy/paste the following line to gdb
#echo
#echo run -X -f $(DOCROOT)/httpd.conf
#echo
$(SHLIBPATH_VAR)=$(LD_LIBRARY_PATH) R_HOME=$(R_HOME) gdb $(HTTPD)
clean:
rm -rf $(OBJS) core mod_R.o mod_R.so *~ .libs *.o *.slo *.lo *.la .apreq-config
$(APREQ_CLEAN)
distclean: clean
rm -rf mod_R.h Makefile .depend .install libtool config.log config.status test/httpd.conf test/access_log test/error_log test/httpd.pid test/accept.lock* aclocal.m4 autom4te.cache libapreq2/library/t/Makefile libapreq2/config.nice libapreq2/module/apache/Makefile
$(APREQ_CLEAN)
Any help would be greatly appreciated.
Thanks, Sho

makefile.am is a template for autotools
makefile.am -> automake -> makefile.in
makefile.in -> autoconf -> Makefile
There must be an INSTALL or a README file.
Generally commands are
./configure
make
make test
make install
try ./configure --help for options (--prefix if you are not admin)

Related

use DKMS to install realtek r8125 driver, get No rule to make target 'CLEAN'

I try to use dkms to install realtek r8125 driver.
The official driver autorun script use this to compile source code
make $# all 1>>log.txt || exit 1
the top level makefile is
KFLAG := 2$(shell uname -r | sed -ne 's/^2\.[4]\..*/4/p')x
all: clean modules install
modules:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x modules
else
$(MAKE) -C src/ modules
endif
clean:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x clean
else
$(MAKE) -C src/ clean
endif
install:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x install
else
$(MAKE) -C src/ install
endif
my dkms.conf is
PACKAGE_NAME="realtek-r8125"
PACKAGE_VERSION="9.009.01"
MAKE="'make' $# all"
CLEAN="'make' clean"
BUILT_MODULE_NAME[0]="r8125"
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/kernel/driver/net/ethernet/realtek"
AUTOINSTALL="yes"
REMAKE_INITRD=no
when I build this project, I get an error
make: *** No rule to make target 'CLEAN'. Stop.
when I change dkms.conf like this
PACKAGE_NAME="realtek-r8125"
PACKAGE_VERSION="9.009.01"
MAKE="'make' all"
CLEAN="'make' clean"
BUILT_MODULE_NAME[0]="r8125"
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/kernel/driver/net/ethernet/realtek"
AUTOINSTALL="yes"
REMAKE_INITRD=no
it run success
why DKMS say "No rule to make target 'CLEAN'" even if there is a clean target in makefile
what is the difference between make all and make $# all

cross compiling kernel module Yocto SDK, errors from missing headers included in other kernel headers

Trying to compile a kernel module with the Yocto SDK toolchain. Using CMakeLists inside CLion with ExternalProject_Add directive.
Makefile:
# Makefile for uio48
ifneq ($(KERNELRELEASE),) # called by kbuild
obj-m := uio48.o
else # called from command line
KERNEL_VERSION = `uname -r`
KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
PWD := $(shell pwd)
MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/gpio/
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
uio48io.o: uio48io.c uio48.h Makefile
#gcc -c $(EXTRA_CFLAGS) uio48io.c
$(CC) -c $(EXTRA_CFLAGS) uio48io.c
libuio48io.a: uio48io.o
ar rcs libuio48io.a uio48io.o
libs: libuio48io.a
all: default libs
install:
#mkdir -p ${PREFIX}/$(MODULE_INSTALLDIR)
#rm -f $(MODULE_INSTALLDIR)uio48.ko
#install -c -m 0644 ${PREFIX}/lib/modules/${KERNEL_VERSION}/extra/uio48.ko ${PREFIX}/$(MODULE_INSTALLDIR)
#install -m 0755 ${PREFIX}flash ${D}${bindir}
#/sbin/depmod -a
uninstall:
rm -f $(MODULE_INSTALLDIR)uio48.ko
/sbin/depmod -a
flash: flash.c uio48.h uio48io.o Makefile
#gcc -static flash.c uio48io.o -o flash
$(CC) flash.c uio48io.o -o flash
chmod a+x flash
diotest: diosetpintest.c uio48.h uio48io.o Makefile
#gcc -static flash.c uio48io.o -o flash
${CC} diosetpintest.c uio48io.o -o diotest
chmod a+x diotest
poll: poll.c uio48.h uio48io.o Makefile
#gcc -D_REENTRANT -static poll.c uio48io.o -o poll -lpthread
${CC} -D_REENTRANT -static poll.c uio48io.o -o poll -lpthread
chmod a+x poll
endif
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions /dev/uio48?
spotless:
rm -rf ioctl poll flash Module.* *.o *~ core .depend .*.cmd *.ko *.mod.c *.order .tmp_versions /dev/uio48?
As you can see I've already modified the make file provided by the vendor. I replaced some build lines with $(CC) to make sure it uses the toolchain compiler. Commented out the Install section because I couldn't figure out how to stop CMake ExternalProject from running the install command; just want to build it.
CMakeLists.txt:
project(driver)
cmake_minimum_required(VERSION 3.17)
enable_language(C ASM CXX)
set(CMAKE_CXX_STANDARD 11)
set(SHARED_LIBRARY_ROOT "$ENV{OECORE_TARGET_SYSROOT}/usr/lib")
set(SHARED_LIBRARY_INCLUDE "$ENV{OECORE_TARGET_SYSROOT}/usr/include")
set(CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
set(TARGET_PLATFORM_INCLUDE "$ENV{OECORE_TARGET_SYSROOT}/usr/src/kernel/include/linux")
set(TARGET_KERNEL_DIR "$ENV{OECORE_TARGET_SYSROOT}/usr/src/kernel")
set(TP_INCLUDE_CFLAG "-I${TARGET_PLATFORM_INCLUDE} -I${SHARED_LIBRARY_INCLUDE}")
MESSAGE(STATUS "CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH}")
MESSAGE(STATUS "TARGET_PLATFORM_INCLUDE ${TARGET_PLATFORM_INCLUDE}")
MESSAGE(STATUS "CMake C compiler ${CMAKE_C_COMPILER}")
include_directories(${CMAKE_CURRENT_LIST_DIR})
include_directories(${SHARED_LIBRARY_ROOT})
include_directories(${SHARED_LIBRARY_INCLUDE})
include(ExternalProject)
ExternalProject_Add(
uio48
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND make all CC=${CMAKE_C_COMPILER} KERNEL_DIR=${TARGET_KERNEL_DIR} EXTRA_CFLAGS=${TP_INCLUDE_CFLAG}
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
BUILD_IN_SOURCE 1
BUILD_ALWAYS 1)
If I leave The Makefile the way it is, I can see from the output I am changing directory to my host kernel source.
partial output:
make[5]: Entering directory `/usr/src/kernels/3.10.0-957.el7.x86_64'
Building modules, stage 2.
MODPOST 1 modules
make[5]: Leaving directory `/usr/src/kernels/3.10.0-957.el7.x86_64'
so I modified these lines in the make file:
#ifneq ($(KERNELRELEASE),) # called by kbuild
# obj-m := uio48.o
#else # called from command line
KERNEL_VERSION = `uname -r`
KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
PWD := $(shell pwd)
MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/gpio/
When I do this, I change directory into my kernel source in the toolchain as the output shows, however...:
ake[5]: Entering directory `/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/src/kernel'
Building modules, stage 2.
MODPOST 0 modules
make[5]: Leaving directory `/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/src/kernel'
#gcc -c -I/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/src/kernel/include/linux -I/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/include uio48io.c
/opt/poky-sdk/2.4.2/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc -c -I/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/src/kernel/include/linux -I/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/include uio48io.c
In file included from /opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/include/stdio.h:33:0,
from uio48io.c:35:
/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/src/kernel/include/linux/stddef.h:4:10: fatal error: uapi/linux/stddef.h: No such file or directory
#include <uapi/linux/stddef.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
now i'm getting an error for a missing header file that is an include from another Linux kernel header file.
After searching for the 'uapi', it shows up under different architectures in the source; ./usr/src/kernel/tools/arch/powerpc/include/uapi for example. so, Im guessing i need to specify the arch in order for it to include the right header but I'm not having any luck.
I tried adding: -march=x86-64 here:
set(TP_INCLUDE_CFLAG "-I${TARGET_PLATFORM_INCLUDE} -I${SHARED_LIBRARY_INCLUDE} -march=x86-64")
.
.
.
BUILD_COMMAND make all CC=${CMAKE_C_COMPILER} KERNELDIR=${TARGET_KERNEL_DIR} EXTRA_CFLAGS=${TP_INCLUDE_CFLAG}
but that didn't seem to work. Any ideas?
UPDATE
if I include the 'uapi' directory, it solves one problem and spawns another. Now I'm getting errors from the linux header files themselves...
example:
set(TARGET_KERNEL_DIR "$ENV{OECORE_TARGET_SYSROOT}/usr/src/kernel")
set(TARGET_PLATFORM_INCLUDE "$ENV{OECORE_TARGET_SYSROOT}/usr/src/kernel/include/linux")
set(TARGET_ARCH_DIR_INCLUDE "$ENV{OECORE_TARGET_SYSROOT}/usr/src/kernel/include/uapi/linux/")
set(USER_INCLUDE "$ENV{OECORE_TARGET_SYSROOT}/usr/include")
set(TP_INCLUDE_CFLAG "-I${TARGET_ARCH_DIR_INCLUDE} -I${TARGET_PLATFORM_INCLUDE} -I${USER_INCLUDE}")
.
.
.
BUILD_COMMAND make all CC=${CMAKE_C_COMPILER} KERNELDIR=${TARGET_KERNEL_DIR} EXTRA_CFLAGS=${TP_INCLUDE_CFLAG}
one of these errors for example:
n file included from /opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/include/stdio.h:41:0,
from uio48io.c:35:
/opt/poky-sdk/2.4.2/sysroots/corei7-64-poky-linux/usr/include/libio.h:302:3: error: unknown type name ‘size_t’
size_t __pad5;
^~~~~~

Simple makefile command not found

I was given a makefile that looks like this, and told not to change it.
all: clean flex scanner.lex bison -d parser.ypp g++ -std=c++11 -o hw2 *.c *.cpp clean: rm -f lex.yy.c rm -f parser.tab.*pp rm -f hw2
I am trying to run this makefile in a folder with files named: scanner.lex, parser.ypp, output.hpp and output.cpp
I copied it to a file like this:
all:
clean flex scanner.lex bison -d parser.ypp g++ -std=c++11 -o hw2 *.c *.cpp
clean:
rm -f lex.yy.c rm -f parser.tab.*pp rm -f hw2
When I run the make command in my terminal I get an error:
clean flex scanner.lex bison -d parser.ypp g++ -std=c++11 -o hw2 *.c *.cpp
/bin/sh: clean: command not found
make: *** [all] Error 127
Am I doing something wrong? Again, I was given this line and told not to change it.
Thanks a lot.
Line breaks are essential in most computer environments. If you were given a Makefile without the line breaks and you try to cut it randomly you will have difficulties before if finally works. Try this, maybe:
all: clean
flex scanner.lex
bison -d parser.ypp
g++ -std=c++11 -o hw2 *.c *.cpp
clean:
rm -f lex.yy.c
rm -f parser.tab.*pp
rm -f hw2
And use tabs to indent the indented lines, not spaces.
Explanations: all and clean are what is called a target in make parlance. They are the names of the things you want make to do. clean to delete some files, all to do everything else. The
target: prerequisite1 prerequisite2...
recipe1
recipe2
...
template is the basic make template. It means that target depends on prerequisite1, prerequisite2 and that in order to build it make shall pass recipe1 to the shell for execution, then recipe2...
Note that this Makefile is poorly written. As all and clean are not real file names they should be declared as phony, such that, if a file with that name exists make does the job anyway. As is, it wouldn't. Give it a try:
$ make all
$ touch clean
$ make clean
make: 'clean' is up to date.
See? Because a file named clean exists you cannot make clean anymore, make considers that there is nothing to do for clean. Add this at the beginning of your Makefile:
.PHONY: all clean
A second issue is that make works by comparing last modification times of targets and prerequisites to decide if targets must be rebuilt or not. With your Makefile make will always recompile everything, even if the inputs did not change and the outputs are up-to-date. This is a waste. A better (but untested) Makefile would be something like:
.PHONY: all clean
CFILES := $(filter-out lex.yy.c,$(wildcard *.c))
CPPFILES := $(filter-out parser.tab.cpp,$(wildcard *.cpp))
all: hw2
hw2: lex.yy.c parser.tab.cpp $(CFILES) $(CPPFILES)
g++ -std=c++11 -o $# $^
lex.yy.c: scanner.lex
flex $<
parser.tab.cpp: parser.ypp
bison -d $<
clean:
rm -f lex.yy.c
rm -f parser.tab.*pp
rm -f hw2
Understanding it and why it is better is left as an exercise.

'make clean' not working

so I made a makefile for a c program. For some reason my 'clean' is not working. Here's a little bit of my makefile:
CC=gcc
FLAGS=-c -Wall -I.
CLEANC=rm -rf *.o
move.o: move.c
$(CC) $(FLAGS) move.c
/*Lot more codes like this^^^*/
clean:
$(CLEANC)
When I run 'make clean' in command prompt, I'm shown the following:
rm -rf *.o
process_begin: CreateProcess(NULL, rm -rf *.o, ...) failed.
make (e=2): The system cannot find the file specified.
makefile:116: recipe for target 'clean' failed
make: *** [clean] Error 2
I can't figure out what I'm doing wrong. I've tried changing CLEANC to
rm -f *.o
rm *.o
rm *o
rm -f *.o test.exe //test.exe is executable
but it still gave me the same error no matter what I tried. I could really use the help. Thanks in advance.
Judging from the CreateProcess appearing in your error output I assume you are running make under Windows.
This means that there is no rm command, you should use del instead and -rf flags should also be adjusted accordingly.
OBJS = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(notdir $(SRCS))))
DELOBJS = $(addprefix .\obj\,$(patsubst %.c,%.o,$(notdir $(SRCS))))
.PHONY: clean
clean:
del xxx
del $(DELOBJS)
del does not work because Windows uses \ to distinguish file paths,so you have to take OBJS with \path, that is, DELOBJS I wrote

no rule to make target but file exists, compiling

I can't seem to debug this, could someone please help? The *.f90 file does exists and the directory is correct. I am not sure what it could be, the gfortran compiler works fine outside of the makefile.
make[1]: Entering directory '/media/f/fv/ED-2.1/ED/build/bin'
make[1]: *** No rule to make target 'media/f/fv/ED-2.1/ED/src/utils/allometry.f90', needed by 'allometry.o'. Stop.
make[1]: Leaving directory '/media/f/fv/ED-2.1/ED/build/bin'
Makefile:24: recipe for target 'all' failed
This is the makefile
#----- Define path and compilation --------------------------------------------------------#
include paths.mk
include include.mk.$(OPT)
#----- Compiler commands. -----------------------------------------------------------------#
INCLUDES = $(PAR_INCS) -I$(ED_INCS) $(HDF5_INCS) $(MPI_INCS)
F90_COMMAND = $(F_COMP) -c $(F_OPTS) $(INCLUDES) $(PAR_DEFS)
FPP_COMMAND = $(F_COMP) -c -DUSE_INTERF=$(USE_INTERF) -DUSENC=$(USENC) -D$(CMACH) \
-DUSE_HDF5=$(USE_HDF5) -DUSE_COLLECTIVE_MPIO=$(USE_COLLECTIVE_MPIO) \
-DUSE_MPIWTIME=$(USE_MPIWTIME) $(F_OPTS) $(INCLUDES) $(PAR_DEFS)
CXX_COMMAND = $(C_COMP) -c $(C_OPTS) -D$(CMACH) $(HDF5_INCS) $(INCLUDES) $(PAR_DEFS)
#----- Define archive and executable names. -----------------------------------------------#
EXE=$(BASE)/ed_$(ED_VERSION)-$(OPT)
LIBMODEL=$(BASE)/ed_$(ED_VERSION)-$(OPT).a
include objects.mk
#----- Define targets. --------------------------------------------------------------------#
all:
make gendep
#$(info $$EXE is [${EXE}])
make $(EXE)
make $(EXE)
make $(EXE)
make $(EXE)
make $(EXE)
gendep:
#echo ""
./generate_deps.sh $(ED_ROOT)
#echo === Finished dependencies ===
$(EXE): $(LIBMODEL) $(MAINOBJ)
#echo ""
$(LOADER) -o $(EXE) edmain.o $(LOADER_OPTS) $(LIBMODEL) $(HDF5_LIBS) $(PAR_LIBS) \
$(NC_LIBS) $(LIBS) $(LOADER_OPTS)
#echo ""
#echo Finished building === $(EXE)
#echo ""
$(MAINOBJ): $(MAIN)
#echo ""
cp -f $< $(<F:.f90=.f90)
$(F90_COMMAND) $(<F:.f90=.f90)
rm -f $(<F:.f90=.f90)
$(LIBMODEL): $(OBJ_MODEL)
$(ARCHIVE) $(LIBMODEL) $(OBJ_MODEL)
FORCE:
install:
#echo ""
ln -fs `pwd`/$(EXE) ../run/$(BASE)
ln -fs `pwd`/$(EXE) ../test/$(BASE)
#echo ""
clean:
#echo ""
rm -f $(LIBMODEL) $(EXE) *.o *.mod *.F90 *.f90 *.stb *.d dependency.mk
rm -f ../$(EXE) ../$(LIBMODEL)
touch dependency.mk
#echo ""
#----- Define rules -----------------------------------------------------------------------#
include rules.mk
This makefile is a hot mess. Why do you have the same command make $(EXE) listed 5 times in a row in the all recipe? Why are you using $(<F:.f90=.f90) which just replaces the string .f90 with an identical string .f90, essentially a no-op?
Further, we don't have enough information here to answer your question: you haven't provided the definition of the variables MAINOBJ or OBJ_MODEL, or more importantly, MAIN. At least one of those is wrong. Unless you've mis-transcribed the error message (please always cut and paste actual errors, don't try to manually type them in!!), then this:
make[1]: *** No rule to make target 'media/f/fv/ED-2.1/ED/src/utils/allometry.f90', needed by 'allometry.o'. Stop.
tells you what the problem is; note there is no slash (/) at the beginning of this pathname, before media. So this is not an absolute path, it's a relative path. That means make is actually trying to find the file named /media/f/fv/ED-2.1/ED/build/bin/media/f/fv/ED-2.1/ED/src/utils/allometry.f90 which clearly won't exist.
We can't tell you why this is happening because you haven't provided the information about how these variables are set. Most likely the bad one is MAIN but it's hard to know for sure.

Resources