Skip to contentSkip to conversation

Makefile: Create empty <config.h> if this header file is not needed by board

RFC In review Alexander Shiyan 2 participants 6 messages Mar 6, 2013 – Mar 11, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

RFC 1/1 Makefile: Create empty <config.h> if this header file is not needed by board

Patch creates empty <config.h> if this header is not needed by board. This will allow to remove many empty config.h files from boards.

---
 Makefile | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Makefile +11 -6
index b5819fc..e8d9984 100644
@@ -898,13 +898,18 @@ include/asm:
 	$(Q)$(check-symlink)
 	$(Q)$(create-symlink)
 
+define symlink-config-h
+	if [ -f $(srctree)/$(BOARD)/config.h ]; then		\
+		$(kecho) '  SYMLINK $@ -> $(BOARD)/config.h';	\
+		ln -fsn $(srctree)/$(BOARD)/config.h $@;	\
+	else							\
+		$(kecho) '  CREATE  $@';			\
+		echo -n > $@;					\
+	fi
+endef
+
 include/config.h: include/config/auto.conf
-	$(Q)$(kecho) '  SYMLINK $@ -> $(BOARD)/config.h'
-ifneq ($(KBUILD_SRC),)
-	$(Q)ln -fsn $(srctree)/$(BOARD)/config.h $@
-else
-	$(Q)ln -fsn ../$(BOARD)/config.h $@
-endif
+	$(Q)$(symlink-config-h)
 
 # Generate some files
 # ---------------------------------------------------------------------------
Signature · 7 lines
1.7.12.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 39 lines

Patch creates empty <config.h> if this header is not needed by board. This will allow to remove many empty config.h files from boards.

---
 Makefile | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Makefile +11 -6
index b5819fc..e8d9984 100644
@@ -898,13 +898,18 @@ include/asm:
 	$(Q)$(check-symlink)
 	$(Q)$(create-symlink)
 
+define symlink-config-h
+	if [ -f $(srctree)/$(BOARD)/config.h ]; then		\
+		$(kecho) '  SYMLINK $@ -> $(BOARD)/config.h';	\
+		ln -fsn $(srctree)/$(BOARD)/config.h $@;	\
+	else							\
+		$(kecho) '  CREATE  $@';			\
+		echo -n > $@;					\
+	fi
+endef
+
 include/config.h: include/config/auto.conf
-	$(Q)$(kecho) '  SYMLINK $@ -> $(BOARD)/config.h'
-ifneq ($(KBUILD_SRC),)
-	$(Q)ln -fsn $(srctree)/$(BOARD)/config.h $@
-else
-	$(Q)ln -fsn ../$(BOARD)/config.h $@
-endif
+	$(Q)$(symlink-config-h)
 
 # Generate some files
 # ---------------------------------------------------------------------------
Signature · 1 line
1.7.12.4

Can anyone comment this patch?
I can resend it with cleanup part. (-50 files).

---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
Quoted 16 lines · Alexander Shiyan
Quoted 16 lines

Patch creates empty <config.h> if this header is not needed by board. This will allow to remove many empty config.h files from boards.

---
 Makefile | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Makefile +0 -0
index b5819fc..e8d9984 100644
@@ -898,13 +898,18 @@ include/asm:
 	$(Q)$(check-symlink)
 	$(Q)$(create-symlink)
 
Quoted 8 lines

Makefile include/asm: · line 908

Quoted 8 lines
Makefile +8 -0
+define symlink-config-h
+	if [ -f $(srctree)/$(BOARD)/config.h ]; then		\
+		$(kecho) '  SYMLINK $@ -> $(BOARD)/config.h';	\
+		ln -fsn $(srctree)/$(BOARD)/config.h $@;	\
+	else							\
+		$(kecho) '  CREATE  $@';			\
+		echo -n > $@;					\
+	fi

How does git incorporate with this? I think git just ignores empty files like these, right?

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Patch creates empty <config.h> if this header is not needed by board. This will allow to remove many empty config.h files from boards.

---
 Makefile | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Makefile +0 -0
index b5819fc..e8d9984 100644
@@ -898,13 +898,18 @@ include/asm:
 	$(Q)$(check-symlink)
 	$(Q)$(create-symlink)
 
Quoted 11 lines
Quoted 8 lines

Makefile include/asm: · line 908

Quoted 8 lines
Makefile +8 -0
+define symlink-config-h
+	if [ -f $(srctree)/$(BOARD)/config.h ]; then		\
+		$(kecho) '  SYMLINK $@ -> $(BOARD)/config.h';	\
+		ln -fsn $(srctree)/$(BOARD)/config.h $@;	\
+	else							\
+		$(kecho) '  CREATE  $@';			\
+		echo -n > $@;					\
+	fi

How does git incorporate with this? I think git just ignores empty files like these, right?

When I say "empty" here, I mean about not zeroed files, but about files without any content. Now we have 50 config.h files like this.

---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#4 lore raw
Quoted 8 lines · Alexander Shiyan
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Patch creates empty <config.h> if this header is not needed by board. This will allow to remove many empty config.h files from boards.

How does git incorporate with this? I think git just ignores empty files like these, right?

When I say "empty" here, I mean about not zeroed files, but about files without any content. Now we have 50 config.h files like this.

My question aimed in the direction whether we end up with empty files in git because people accidently add these now generated files.

I think the goal should be to get rid of the config.h files entirely. This patch (or better: the removal of the empty files) could be a good start to see what's left.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw
Quoted 10 lines · Alexander Shiyan
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Patch creates empty <config.h> if this header is not needed by board. This will allow to remove many empty config.h files from boards.

How does git incorporate with this? I think git just ignores empty files like these, right?

When I say "empty" here, I mean about not zeroed files, but about files without any content. Now we have 50 config.h files like this.

Quoted 6 lines

My question aimed in the direction whether we end up with empty files in git because people accidently add these now generated files.

I think the goal should be to get rid of the config.h files entirely. This patch (or better: the removal of the empty files) could be a good start to see what's left.

OK, let's see. I will send the patch again. Second part is a cleanup.

---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox