Hello guys, I'm trying to make this work

all: daemon client

daemon:	
	cd ./daemon; make daemon
client: 
	echo going in
	cd ./client; make client
clean:
	cd ./daemon ; make clean
	cd ./client ; make clean

But I'm having 2 problems:
1) Make ALWAYS tells me there's nothing to be done. Wether I try to make daemon, client or all. The echo command doesn't even seem to work.
Edit: turns out I can't use the command "make daemon" on both the main makefile and the secondary makefile.


2) Clean DOES work but it doesn't clean the client if cleaning the daemon failed.

Recommended Answers

All 4 Replies

Hello guys, I'm trying to make this work

all: daemon client

daemon:	
	cd ./daemon; make daemon
client: 
	echo going in
	cd ./client; make client
clean:
	cd ./daemon ; make clean
	cd ./client ; make clean

But I'm having 2 problems:
1) Make ALWAYS tells me there's nothing to be done. Wether I try to make daemon, client or all. The echo command doesn't even seem to work.
Edit: turns out I can't use the command "make daemon" on both the main makefile and the secondary makefile.


2) Clean DOES work but it doesn't clean the client if cleaning the daemon failed.

So you have makefiles in the ./client and ./daemon
directories?

Plus I've always seem makefiles like

all: daemon client

daemon:	
	cd ./daemon
	make daemon
client: 
	echo going in
	cd ./client
	make client
clean:
	cd ./daemon
	make clean
	cd ./client
	make clean

Doing what you suggested (putting cd and make in seperate lines) will execute "make" in the current directory (basicaly, cd only effects the line it's in)

did you try putting the full path with your cd

Sorry about taking this long to reply.

The solution is rather simple. The primary makefiles has a variable daemon. One of the secondary makefiles also tries to "make daemon". Since the primary file has already run "make daemon", the secondary one reports nothing to be done and exits.

So all I had to do is make sure one makefile makes daemon and the other makes daemon1 or something else, as long as it bears a different name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.