Discussion:
Issues with defining output objects
zxuiji
2015-11-28 16:16:54 UTC
Permalink
I'm still new to makefiles so could someone help me understand the below
correctly please.Here's the snippet of my makefile:
SOURCES=$(wildcard *.c)OBJECTS=$(SOURCES:%.c=%.o)...$(.DEFAULT_GOAL):
$(.DEFAULT_GOAL)/$(OBJECTS) $(CC) $(.DEFAULT_GOAL)/$(OBJECTS) -o
$(OUT)$(.DEFAULT_GOAL)/%.o: %.c $(CC) $(TAR_LIBS) $(TAR_INCS) $(TAR_OBJF) -c
$< -o $@
And this is the output I'm getting after the 1st file:
/MinGW64/bin/mingw32-make.exe (in directory:
E:\PortableApps\Codit\coditui)/MinGW64/mingw/bin/mingw32-gcc.exe
win32_dbg/search.o main.o inject.o -o
./../bin/codit_win32_dbg.exemain.o:search.c:(.text+0x0): multiple definition
of `sysOpenProc'win32_dbg/search.o:search.c:(.text+0x0): first defined
heremain.o:search.c:(.text+0x11b): multiple definition of
`sysShutProc'win32_dbg/search.o:search.c:(.text+0x11b): first defined
heremain.o:search.c:(.text+0x13d): multiple definition of
`uquery'win32_dbg/search.o:search.c:(.text+0x13d): first defined
heremain.o:search.c:(.text+0x156): multiple definition of
`iquery'win32_dbg/search.o:search.c:(.text+0x156): first defined
heremain.o:search.c:(.text+0x16f): multiple definition of
`fquery'win32_dbg/search.o:search.c:(.text+0x16f): first defined
heremain.o:search.c:(.text+0x188): multiple definition of
`squery'win32_dbg/search.o:search.c:(.text+0x188): first defined
heremain.o:search.c:(.bss+0x0): multiple definition of
`procId'win32_dbg/search.o:search.c:(.bss+0x0): first defined
heremain.o:search.c:(.bss+0x4): multiple definition of
`procHandle'win32_dbg/search.o:search.c:(.bss+0x4): first defined
heremain.o:search.c:(.bss+0x8): multiple definition of
`procMemAddr'win32_dbg/search.o:search.c:(.bss+0x8): first defined
heremain.o:search.c:(.bss+0xc): multiple definition of
`procMemSize'win32_dbg/search.o:search.c:(.bss+0xc): first defined
hereinject.o:search.c:(.text+0x0): multiple definition of
`sysOpenProc'win32_dbg/search.o:search.c:(.text+0x0): first defined
hereinject.o:search.c:(.text+0x11b): multiple definition of
`sysShutProc'win32_dbg/search.o:search.c:(.text+0x11b): first defined
hereinject.o:search.c:(.text+0x13d): multiple definition of
`uquery'win32_dbg/search.o:search.c:(.text+0x13d): first defined
hereinject.o:search.c:(.text+0x156): multiple definition of
`iquery'win32_dbg/search.o:search.c:(.text+0x156): first defined
hereinject.o:search.c:(.text+0x16f): multiple definition of
`fquery'win32_dbg/search.o:search.c:(.text+0x16f): first defined
hereinject.o:search.c:(.text+0x188): multiple definition of
`squery'win32_dbg/search.o:search.c:(.text+0x188): first defined
hereinject.o:search.c:(.bss+0x0): multiple definition of
`procId'win32_dbg/search.o:search.c:(.bss+0x0): first defined
hereinject.o:search.c:(.bss+0x4): multiple definition of
`procHandle'win32_dbg/search.o:search.c:(.bss+0x4): first defined
hereinject.o:search.c:(.bss+0x8): multiple definition of
`procMemAddr'win32_dbg/search.o:search.c:(.bss+0x8): first defined
hereinject.o:search.c:(.bss+0xc): multiple definition of
`procMemSize'win32_dbg/search.o:search.c:(.bss+0xc): first defined
herewin32_dbg/search.o:search.c:(.text+0x7): undefined reference to
`coditRef'win32_dbg/search.o:search.c:(.text+0xf): undefined reference to
`coditPtr'main.o:search.c:(.text+0x7): undefined reference to
`coditRef'main.o:search.c:(.text+0xf): undefined reference to
`coditPtr'inject.o:search.c:(.text+0x7): undefined reference to
`coditRef'inject.o:search.c:(.text+0xf): undefined reference to
`coditPtr'e:/mingw64/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o):(.text.startup+0xa7):
undefined reference to `***@16'collect2.exe: error: ld returned 1 exit
statusmakefile:19: recipe for target 'win32_dbg' failedmingw32-make.exe: ***
[win32_dbg] Error 1Compilation failed.




--
View this message in context: http://gnu-make.2324884.n4.nabble.com/Issues-with-defining-output-objects-tp16716.html
Sent from the Gnu - Make - W32 mailing list archive at Nabble.com.
zxuiji
2015-11-29 10:37:53 UTC
Permalink
Never mind, I figured out how to sort it:
...OBJS=$(patsubst %.c, ${CURDIR}/../objs/$(.DEFAULT_GOAL)/%.o,
$(SOURCES))OUT=${CURDIR}/../../bin/codit_$(.DEFAULT_GOAL)$(EXE)$(.DEFAULT_GOAL):
$(OBJS) $(CC) $(LIBS) $(OBJS) -o $(OUT)$(OBJS):
${CURDIR}/../objs/$(.DEFAULT_GOAL)/%.o : %.c $(CC) -v $(LIBS) $(INCS)
$(CFLAGS) -c $< -o $@...
I shifted the OBJS variable to after the forced definition of .DEFAULT_GOAL
to ensure nothing went to undesired locations.



--
View this message in context: http://gnu-make.2324884.n4.nabble.com/Issues-with-defining-output-objects-tp16716p16719.html
Sent from the Gnu - Make - W32 mailing list archive at Nabble.com.
Loading...