Skip to contentSkip to conversation

user-cr: Makefile cleanups

PATCH Applied Matt Helsley 3 participants 9 messages Feb 26, 2010 – Mar 1, 2010 2 messages not in the archive Kbuild

lore
Share & tools
lore
#0 lore raw

cover user-cr: Makefile cleanups

Some minor fixes to the Makefile:

[PATCH 1/4] user-cr: Add install prefix
[PATCH 2/4] user-cr: Make directories during install [PATCH 3/4] user-cr: Fix install rule dependencies
[PATCH 4/4] user-cr: Remove pointless echo lines and @-prefixed lines

Cheers,
-Matt Helsley

A message that is not in the archive (sent off-list or not yet received): 1267210602-11444-1-git-send-email-matthltc-r/[email protected]

#2 lore raw

PATCH 1/4 user-cr: Add install prefix

Add an install prefix rather than require setting both BIN_INSTALL_DIR and LIB_INSTALL_DIR.

---
 Makefile |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Makefile +3 -2
index b312358..a8f426a 100644
@@ -18,8 +18,9 @@ WARNS := -Wall -Wstrict-prototypes -Wno-trigraphs
 CFLAGS += -g $(WARNS) $(CKPT_INCLUDE) $(DEBUG)
 
 # install dir
-BIN_INSTALL_DIR = /bin
-LIB_INSTALL_DIR = /lib
+PREFIX ?= /usr/local
+BIN_INSTALL_DIR := $(PREFIX)/bin
+LIB_INSTALL_DIR := $(PREFIX)/lib
 
 ECLONE_PROGS = restart nsexec
 PROGS =	checkpoint ckptinfo $(ECLONE_PROGS)
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 2/4 user-cr: Make directories during install

In reply to a message not in the archive

This makes the directories needed to hold the installed files if they do not already exist.

---
 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Makefile +1 -0
index a8f426a..e776857 100644
@@ -68,6 +68,7 @@ ckptinfo_types.c: $(CKPT_HEADERS) ckptinfo.py
 	cat $(CKPT_HEADERS) | ./ckptinfo.py > ckptinfo_types.c
 
 install:
+	/usr/bin/install -d -D $(BIN_INSTALL_DIR) $(LIB_INSTALL_DIR)
 	@echo /usr/bin/install -m 755 checkpoint restart nsexec ckptinfo $(BIN_INSTALL_DIR)
 	@/usr/bin/install -m 755 checkpoint restart ckptinfo nsexec $(BIN_INSTALL_DIR)
 	@echo /usr/bin/install -m 755 $(LIB_ECLONE) $(LIB_INSTALL_DIR)
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH 3/4 user-cr: Fix install rule dependencies

In reply to a message not in the archive

Since we're installing these programs we need them to be built first.

---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index e776857..f8b113a 100644
@@ -67,7 +67,7 @@ ckptinfo: ckptinfo_types.o
 ckptinfo_types.c: $(CKPT_HEADERS) ckptinfo.py
 	cat $(CKPT_HEADERS) | ./ckptinfo.py > ckptinfo_types.c
 
-install:
+install: $(PROGS)
 	/usr/bin/install -d -D $(BIN_INSTALL_DIR) $(LIB_INSTALL_DIR)
 	@echo /usr/bin/install -m 755 checkpoint restart nsexec ckptinfo $(BIN_INSTALL_DIR)
 	@/usr/bin/install -m 755 checkpoint restart ckptinfo nsexec $(BIN_INSTALL_DIR)
Signature · 1 line
1.6.3.3
#5 lore raw

PATCH 4/4 user-cr: Remove pointless echo lines and @-prefixed lines

In reply to a message not in the archive

In Make, actions prefixed with @ do not produce output showing what Make is executing. It seems rather silly to manually echo the precise output Make would produce automatically without the @ prefix.

---
 Makefile |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
Makefile +2 -4
index f8b113a..a4a1a8a 100644
@@ -69,10 +69,8 @@ ckptinfo_types.c: $(CKPT_HEADERS) ckptinfo.py
 
 install: $(PROGS)
 	/usr/bin/install -d -D $(BIN_INSTALL_DIR) $(LIB_INSTALL_DIR)
-	@echo /usr/bin/install -m 755 checkpoint restart nsexec ckptinfo $(BIN_INSTALL_DIR)
-	@/usr/bin/install -m 755 checkpoint restart ckptinfo nsexec $(BIN_INSTALL_DIR)
-	@echo /usr/bin/install -m 755 $(LIB_ECLONE) $(LIB_INSTALL_DIR)
-	@/usr/bin/install -m 755 $(LIB_ECLONE) $(LIB_INSTALL_DIR)
+	/usr/bin/install -m 755 checkpoint restart ckptinfo nsexec $(BIN_INSTALL_DIR)
+	/usr/bin/install -m 755 $(LIB_ECLONE) $(LIB_INSTALL_DIR)
 
 $(CKPT_HEADERS): %:
 	./scripts/extract-headers.sh -s $(KERNELSRC) -o ./include
Signature · 1 line
1.6.3.3
#6 lore raw
In reply to a message not in the archive
Quoted 6 lines · Matt Helsley

Some minor fixes to the Makefile:

[PATCH 1/4] user-cr: Add install prefix
[PATCH 2/4] user-cr: Make directories during install [PATCH 3/4] user-cr: Fix install rule dependencies
[PATCH 4/4] user-cr: Remove pointless echo lines and @-prefixed lines

ack 1-4

#7 lore raw

PATCH 1/1 user-cr: Makefile: Use standard variables

In reply to a message not in the archive

[Based on the previous series of Makefile patches]

These are standard variables which many cross compiler systems will setup. I believe they are also variables Make sets up with default values. Make also sets $(MAKE) so you don't accidentally mix make binaries in the same build -- let's use that too.

---
 Makefile |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index a4a1a8a..60ddccd 100644
@@ -34,10 +34,10 @@ LDLIBS = -lm
 .PHONY: all distclean clean headers install
 
 all: $(PROGS)
-	@make -C test
+	@$(MAKE) -C test
 
 $(LIB_ECLONE):
-	ar ruv $(LIB_ECLONE) $^
+	$(AR) ruv $(LIB_ECLONE) $^
 
 # restart needs to be thread-safe
 restart: CFLAGS += -D__REENTRANT -pthread
@@ -82,4 +82,4 @@ distclean: clean
 
 clean:
 	@rm -f $(PROGS) $(LIB_ECLONE) $(OTHER) *~ *.o headers.h
-	@make -C test clean
+	@$(MAKE) -C test clean
Signature · 1 line
1.6.3.3

A message that is not in the archive (sent off-list or not yet received): 92a207e405307fe1dc528f59e08782985830d5e9.1267213393.git.matthltc-r/[email protected]

Applied
#9 lore raw

Re: [PATCH] user-cr: Makefile: Use standard variables

Applied, thanks.

Quoted 35 lines · Matt Helsley

[Based on the previous series of Makefile patches]

These are standard variables which many cross compiler systems will setup. I believe they are also variables Make sets up with default values. Make also sets $(MAKE) so you don't accidentally mix make binaries in the same build -- let's use that too.

---
 Makefile |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index a4a1a8a..60ddccd 100644
@@ -34,10 +34,10 @@ LDLIBS = -lm
 .PHONY: all distclean clean headers install
 
 all: $(PROGS)
-	@make -C test
+	@$(MAKE) -C test
 
 $(LIB_ECLONE):
-	ar ruv $(LIB_ECLONE) $^
+	$(AR) ruv $(LIB_ECLONE) $^
 
 # restart needs to be thread-safe
 restart: CFLAGS += -D__REENTRANT -pthread
@@ -82,4 +82,4 @@ distclean: clean
 
 clean:
 	@rm -f $(PROGS) $(LIB_ECLONE) $(OTHER) *~ *.o headers.h
-	@make -C test clean
+	@$(MAKE) -C test clean
Applied
#10 lore raw
In reply to a message not in the archive

Applied, thanks.

Quoted 10 lines · Matt Helsley

Some minor fixes to the Makefile:

[PATCH 1/4] user-cr: Add install prefix
[PATCH 2/4] user-cr: Make directories during install [PATCH 3/4] user-cr: Fix install rule dependencies
[PATCH 4/4] user-cr: Remove pointless echo lines and @-prefixed lines

Cheers,
-Matt Helsley