make: *** No rule to make target 'loader64.o', needed by 'wind64.exe'. Stop - makefile

Trying to compile WindowsD project with MSYS2-MINGW64 and get this error:
make: *** No rule to make target 'loader64.o', needed by 'wind64.exe'. Stop.
For the first time I am dealing with a makefile, I have tried many solutions to the problem that I found on the Internet, but without success..
How to resolve this problem?
Makefile problem part:
...
%.o : %.rc
windres $< $#
...
ifneq ($(LOADERS),)
loader32.rc: win7sp1x86/termdd.sys
echo -e '#include "defs.h"\nLOADER_ID RCDATA "$<"' | windres -o $#
loader64.rc: win7sp1x64/termdd.sys
echo -e '#include "defs.h"\nLOADER_ID RCDATA "$<"' | windres -o $#
endif
...

Related

Make error: main.o: Command not found Makefile: recipe for target 'all' failed

# Makefile for Defmod
FFLAGS =
FPPFLAGS =
LDLIBS =
-include ${PETSC_DIR}/conf/variables
-include ${PETSC_DIR}/conf/rules
-include ${PETSC_DIR}/lib/petsc/conf/variables
-include ${PETSC_DIR}/lib/petsc/conf/rules
OBJS = main.o m_global.o m_local.o m_elems.o m_utils.o
m_utils.o : m_utils.F90
m_elems.o : m_elems.F90 m_utils.o
m_local.o : m_local.F90 m_elems.o
m_global.o: m_global.F90 m_local.o
main.o : main.F90 m_global.o
all: ${OBJS}
-${FLINKER} ${OBJS} -o ../defmod ${PETSC_LIB} ${LDLIBS}
when I enter make all, it pops out:
make[1]: Entering directory '/mnt/c/Users/gxyan/defmod-dev/src'
main.o m_global.o m_local.o m_elems.o m_utils.o -o ../defmod
make[1]: main.o: Command not found
Makefile:21: recipe for target 'all' failed
make[1]: [all] Error 127 (ignored)
make[1]: Leaving directory '/mnt/c/Users/gxyan/defmod-dev/src'
and all the environment variables of PETSC is set.
the configure of PETSC is done with the command:
./configure --with-cc=gcc --with-fc=gfortran --download-mpich --download-fblaslapack --download-cmake --download-metis --with-debugging=0
So, what's wrong?
make variable FLINKER is either not defined, or is defined but has the empty string value
You need to first set the PETSC_DIR variable. E.g., in BASH do:
export PETSC_DIR=/home/user/petsc
followed by
make all
Alternatively, you can do:
make all PETSC_DIR=/home/user/petsc

Makefile: checking existence of files

I'm working on a makefile that uses c source files and header files.
I would like to check if all those files exist before compiling, so that if one is missing, printing a customized message instead of the usual 'no rule to make target'.
The code is as follows:
PROG1=file1
PROG2=file2
INCLUDE=header
all: $(PROG1).x $(PROG2).x
%.x : %.c $(INCLUDE).c
$(CC) -o $/$# $^
# echo File $# has been successfully created from $^;
Where and how should I check that file1.c, file2.c and header.h exist to print a customized error message if any of them is missing?
PROG1=file1
PROG2=file2
INCLUDE=header
all: $(PROG1).x $(PROG2).x
%.x : %.c $(INCLUDE).c
$(CC) -o $/$# $^
#echo File $# has been successfully created from $^
%.c :
#echo Missing $#
%.h :
#echo Missing $#
Would that work? If those files don't exist you'd get something like the following output:
posey#DEATHSTAR:~$ make all
Missing file1.c
Missing header.c
cc -o file1.x file1.c header.c
cc: error: file1.c: No such file or directory
cc: error: header.c: No such file or directory
cc: fatal error: no input files
compilation terminated.
make: *** [file1.x] Error 4

If statements not being properly evaluated (automake, makefile.am)

Now that I finally got xmonad to play nicely with MATE DE, I though I would try to port the GNOME2/3/XFCE4 panel applet over to mate, since MATE is fundamentally GNOME2.
So far, I have added the necessary dependencies, ifdef's etc. for MATE, and running autogen.sh --with-panel=mate spits out a Makefile with showing any errors. However, running make gives this error: Makefile:770: *** missing separator. Stop. Here's my Makefile: http://pastebin.com/bLF9TD4M .
Here's the part that is causing the error:
# $(applet_files): $(applet_files:.desktop=.desktop.in)
# $(SED) -e "s|\#PLUGIN_DIR\#|$(PLUGIN_DIR)|" $< > $#
if PANEL_MATE
applet_files = org.mate.panel.XmonadLogApplet.panel-applet
$(applet_files): $(applet_files:.panel-applet=.panel-applet.in)
$(SED) -e "s|\#PLUGIN_DIR\#|$(PLUGIN_DIR)|" $< > $#
else
applet_files = org.gnome.panel.XmonadLogApplet.panel-applet
$(applet_files): $(applet_files:.panel-applet=.panel-applet.in)
$(SED) -e "s|\#PLUGIN_DIR\#|$(PLUGIN_DIR)|" $< > $#
endif
if !PANEL_MATE
servicedir = $(SESSION_BUS_SERVICES_DIR)
service_in_files = org.gnome.panel.applet.XmonadLogAppletFactory.service.in
service_DATA = $(service_in_files:.service.in=.service)
org.gnome.panel.applet.XmonadLogAppletFactory.service: $(service_in_files)
$(SED) -e "s|\#PLUGIN_DIR\#|$(PLUGIN_DIR)|" $< > $#
else
servicedir = $(SESSION_BUS_SERVICES_DIR)
service_in_files = org.mate.panel.applet.XmonadLogAppletFactory.service.in
service_DATA = $(service_in_files:.service.in=.service)
org.mate.panel.applet.XmonadLogAppletFactory.service: $(service_in_files)
$(SED) -e "s|\#PLUGIN_DIR\#|$(PLUGIN_DIR)|" $< > $#
endif
Those IF statements are left-overs from the Makefile.am file, and they shouldn't be here. If I manually remove the if statements (keeping the relevent stuff inside them) and run make, I get this:
make all-am
make[1]: Entering directory `/home/ari/development/xmonad-log-applet'
gcc -DHAVE_CONFIG_H -I. -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -MT xmonad_log_applet-main.o -MD -MP -MF .deps/xmonad_log_applet-main.Tpo -c -o xmonad_log_applet-main.o `test -f 'main.c' || echo './'`main.c
main.c:15:21: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.
make[1]: *** [xmonad_log_applet-main.o] Error 1
make[1]: Leaving directory `/home/ari/development/xmonad-log-applet'
make: *** [all] Error 2
This is the first time I have really used makefiles and automake, so any help would be appreciated. Here are my modifications on github: https://github.com/geniass/xmonad-log-applet
You can't indent code within if blocks in Automake. (Makefiles are sensitive to indentation.)

make: *** No rule to make target `all'. Stop

I keep getting this error:
make: *** No rule to make target `all'. Stop.
Even though my make file looks like this:
CC=gcc
CFLAGS=-c -Wall
all: build
build: inputText.o outputText.o main.o
gcc main.o inputText.o outputText.o -o main
main.o: main.c
$(CC) $(CFLAGS) main.c -o main.o
inputText.o: inputText.c
$(CC) $(CFLAGS) inputText.c -o inputText.o
outputText.o: outputText.c
$(CC) $(CFLAGS) outputText.c -o outputText.o
Yes there should be a tab space underneath the target and there is in my make file.
I can get it to work if I try one of the targets like main.o, inputText.o and outputText.o but can't with either build or all.
EDIT:
I just randomly tried running make and telling it the file using the following command:
make -f make
This works but why doesn't just typing make work?
Your makefile should ideally be named makefile, not make. Note that you can call your makefile anything you like, but as you found, you then need the -f option with make to specify the name of the makefile. Using the default name of makefile just makes life easier.

Compilation errors with Make File creation

While running my make file which is as follows,
../bin/output : ../lib/libfun.a ../obj/main.o
gcc ../main.o -L ../lib/ -lfun -o $#
../lib/libfun.a : ../obj/file_write.o ../obj/error.o
ar -rc $# $^
../obj/main.o : ../src/main.c
gcc -c $^ -o $# -I ../include
../obj/file_write.o : ../src/file_write.c
gcc -c $^ -o $# -I ../include
../obj/error.o : ../src/error.c
gcc -c $^ -o $# -I ../include
I am getting error like
make: Warning: File `makefile' has modification time 2.2e+03 s in the future
ar -rc ../lib/libfun.a ../obj/file_write.o ../obj/error.o
ar: ../lib/libfun.a: No such file or directory
make: *** [../lib/libfun.a] Error 1
and sometimes
"* missing separator (did you mean TAB instead of 8 spaces?). Stop"
Why is this happening? I gave correct Target,Pre-Requests and Command values whichever needed. Whats wrong in this?
For the first error, make sure the ../lib directory exists before trying to create a library in it. ar will return that error if the path doesn't exist.
For the second make syntax is strict: the commands after a target must be indented with a tab, not spaces.
target: deps
command
# ^ this here needs to be a tab character, not spaces

Resources