'I am getting following Makefile error, any helpful suggestions are appreciated
Can anyone tell what am I doing wrong in my make file? Any help in correct direction is appreciated. Error:
make: ../apue.3e/systype.sh: Command not found
Makefile:3: ../apue.3e/Make.defines.: No such file or directory
Makefile:15: ../apue.3e/Make.libapue.inc: No such file or directory
make: *** No rule to make target `../apue.3e/Make.libapue.inc'. Stop.
My Makefile looks like this currently:
ROOT=../apue.3e
PLATFORM=$(shell $(ROOT)/systype.sh)
include $(ROOT)/Make.defines.$(PLATFORM)
PROGS = shell2
all: $(PROGS)
%: %.c $(LIBAPUE)
$(CC) $(CFLAGS) [email protected] -o $@ $(LDFLAGS) $(LDLIBS)
clean:
rm -f $(PROGS) $(TEMPFILES) *.o
include $(ROOT)/Make.libapue.inc
My directories structure looks like this,I think my ROOT path is not correct but I cant figure out :
[singhrav@csci-gnode-02 ~]$ pwd
/export/homes/singhrav
[singhrav@csci-gnode-02 ~]$ ls
a.out cse_grid_tutorial Makefile OOP server tmp
client Homework03SinghRav Millionproject1 output shell2.c typescript
csci3800hw-singh.txt hw2 mysearch-result.txt output2 SinghRavisher_04
csci3800sp22 lab1 myShell pythonProject SinghRavisher_HW02
[singhrav@csci-gnode-02 ~]$ cd csci3800sp22
[singhrav@csci-gnode-02 ~/csci3800sp22]$ ls
apue.3e src.3e.tar.gz
[singhrav@csci-gnode-02 ~/csci3800sp22]$ cd apue.3e
[singhrav@csci-gnode-02 apue.3e]$ ls
cadvio environ include Make.defines.freebsd Make.libapue.inc relation systype.sh
daemons exercises intro Make.defines.linux printer signals termios
datafiles figlinks ipc1 Make.defines.macos proc sockets threadctl
db filedir ipc2 Make.defines.solaris pty standards threads
DISCLAIMER fileio lib Makefile README stdio
[singhrav@csci-gnode-02 apue.3e]$ cd intro
[singhrav@csci-gnode-02 intro]$ ls
getcputc hello ls1 Makefile mycat.c shell1.c shell2.c testerror.c uidgid.c
getcputc.c hello.c ls1.c mycat shell1 shell2 testerror uidgid
[singhrav@csci-gnode-02 intro]$ cp /export/homes/singhrav/csci3800sp22/apue.3e/intro/shell2 /export/homes/singhrav/lab1
[singhrav@csci-gnode-02 intro]$ cd ..
[singhrav@csci-gnode-02 apue.3e]$ cd ..
[singhrav@csci-gnode-02 ~/csci3800sp22]$ ls
apue.3e src.3e.tar.gz
[singhrav@csci-gnode-02 ~/csci3800sp22]$ cd ..
[singhrav@csci-gnode-02 ~]$ ls
a.out cse_grid_tutorial Makefile OOP server tmp
client Homework03SinghRav Millionproject1 output shell2.c typescript
csci3800hw-singh.txt hw2 mysearch-result.txt output2 SinghRavisher_04
csci3800sp22 lab1 myShell pythonProject SinghRavisher_HW02
[singhrav@csci-gnode-02 ~]$ cd lab1
[singhrav@csci-gnode-02 ~/lab1]$ ls
Makefile shell2
Solution 1:[1]
Relative paths in a makefile are interpreted relative to the current working directory, not relative to the location of the makefile in which they appear.
Given the directory structure and makefile content you show, therefore, that makefile will only work if you launch make from directory csci3800sp22/apue.3e, which makes the whole ROOT business more or less moot. You have not provided enough information about how and from where you are launching make to support a recommendation of what you should do instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | John Bollinger |
