Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 1 | From 4f887cc665c9a48b83e20ef4abe57afa7e365e0e Mon Sep 17 00:00:00 2001 |
| 2 | From: Hongxu Jia <hongxu.jia@eng.windriver.com> |
| 3 | Date: Tue, 5 Dec 2023 23:02:22 -0800 |
| 4 | Subject: [PATCH v2] fix compile procan.c failed |
| 5 | |
| 6 | 1. Compile socat failed if out of tree build (build dir != source dir) |
| 7 | ... |
| 8 | gcc -c -D CC="gcc" -o procan.o procan.c |
| 9 | cc1: fatal error: procan.c: No such file or directory |
| 10 | ... |
| 11 | Explicitly add $srcdir to makefile rule |
| 12 | |
| 13 | 2. Compile socat failed if multiple words in $(CC), such as CC="gcc -m64" |
| 14 | ... |
| 15 | from ../socat-1.8.0.0/procan.c:10: |
| 16 | ../socat-1.8.0.0/sysincludes.h:18:10: fatal error: inttypes.h: No such file or directory |
| 17 | 18 | #include <inttypes.h> /* uint16_t */ |
| 18 | ... |
| 19 | |
| 20 | In commit [Procan: print umask, CC, and couple more new infos][1], |
| 21 | it defeines marcro CC in C source, the space in CC will break |
| 22 | C source compile. Use first word of $(CC) to defeine marco CC |
| 23 | |
| 24 | [1] https://repo.or.cz/socat.git/commit/cd5673dbd0786c94e0b3ace7e35fab14c01e3185 |
| 25 | |
| 26 | Upstream-Status: Submitted [socat@dest-unreach.org] |
| 27 | Signed-off-by: Hongxu Jia <hongxu.jia@eng.windriver.com> |
| 28 | --- |
| 29 | Makefile.in | 10 +++++----- |
| 30 | 1 file changed, 5 insertions(+), 5 deletions(-) |
| 31 | |
| 32 | diff --git a/Makefile.in b/Makefile.in |
| 33 | index c01b1a4..48dad69 100644 |
| 34 | --- a/Makefile.in |
| 35 | +++ b/Makefile.in |
| 36 | @@ -109,8 +109,8 @@ depend: $(CFILES) $(HFILES) |
| 37 | socat: socat.o libxio.a |
| 38 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS) |
| 39 | |
| 40 | -procan.o: procan.c |
| 41 | - $(CC) $(CFLAGS) -c -D CC=\"$(CC)\" -o $@ procan.c |
| 42 | +procan.o: $(srcdir)/procan.c |
| 43 | + $(CC) $(CFLAGS) -c -D CC=\"$(firstword $(CC))\" -o $@ $(srcdir)/procan.c |
| 44 | |
| 45 | PROCAN_OBJS=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o vsnprintf_r.o snprinterr.o |
| 46 | procan: $(PROCAN_OBJS) |
| 47 | @@ -132,9 +132,9 @@ install: progs $(srcdir)/doc/socat.1 |
| 48 | mkdir -p $(DESTDIR)$(BINDEST) |
| 49 | $(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)/socat1 |
| 50 | ln -sf socat1 $(DESTDIR)$(BINDEST)/socat |
| 51 | - $(INSTALL) -m 755 socat-chain.sh $(DESTDIR)$(BINDEST) |
| 52 | - $(INSTALL) -m 755 socat-mux.sh $(DESTDIR)$(BINDEST) |
| 53 | - $(INSTALL) -m 755 socat-broker.sh $(DESTDIR)$(BINDEST) |
| 54 | + $(INSTALL) -m 755 $(srcdir)/socat-chain.sh $(DESTDIR)$(BINDEST) |
| 55 | + $(INSTALL) -m 755 $(srcdir)/socat-mux.sh $(DESTDIR)$(BINDEST) |
| 56 | + $(INSTALL) -m 755 $(srcdir)/socat-broker.sh $(DESTDIR)$(BINDEST) |
| 57 | $(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST) |
| 58 | $(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST) |
| 59 | mkdir -p $(DESTDIR)$(MANDEST)/man1 |
| 60 | -- |
| 61 | 2.42.0 |
| 62 | |