1From bb19a2c7e5b3142d70d3e13c2d8a92a63f2b840a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 20 Nov 2019 22:12:52 -0800
4Subject: [PATCH] Make space for flags from environment
5
6Add force option to ln cmd, so do_install can be rerun in same directory
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 sample/Makefile | 20 ++++++++++----------
12 src/Makefile    |  8 ++++----
13 2 files changed, 14 insertions(+), 14 deletions(-)
14
15diff --git a/sample/Makefile b/sample/Makefile
16index 15cafd9..d83641f 100644
17--- a/sample/Makefile
18+++ b/sample/Makefile
19@@ -35,9 +35,9 @@ ifeq ($(PLATFORM),SunOS)
20 SOLARIS_LIBS = -lresolv -lnsl -lsocket
21 endif
22
23-CC      = gcc
24-CFLAGS  = -O2 -pipe -Wall -g -I../src -I$(OOP_INCLUDE_DIR)
25-LDFLAGS = -L../src -L$(OOP_LIB_DIR) $(SOLARIS_LDFLAGS)
26+CC      ?= gcc
27+CFLAGS  += -O2 -pipe -Wall -g -I../src -I$(OOP_INCLUDE_DIR)
28+LDFLAGS += -L../src -L$(OOP_LIB_DIR) $(SOLARIS_LDFLAGS)
29 UNRULI_LINK = $(CC) $(ARCH) $(LDFLAGS) -o $@ $^ $(SOLARIS_LIBS)
30 LINK = $(UNRULI_LINK) -lruli -loop
31
32@@ -65,13 +65,13 @@ install: $(TARGETS)
33 	mkdir -p $(INSTALL_BIN_DIR) $(INSTALL_MAN1_DIR)
34 	cp $(TARGETS) $(INSTALL_BIN_DIR)
35 	cp ../doc/man/*.1 $(INSTALL_MAN1_DIR)
36-	cd $(INSTALL_MAN_DIR)/man1 && ln -s srvsearch.1 smtpsearch.1
37-	cd $(INSTALL_MAN_DIR)/man1 && ln -s srvsearch.1 httpsearch.1
38-	cd $(INSTALL_MAN_DIR)/man1 && ln -s srvsearch.1 sync_srvsearch.1
39-	cd $(INSTALL_MAN_DIR)/man1 && ln -s srvsearch.1 sync_smtpsearch.1
40-	cd $(INSTALL_MAN_DIR)/man1 && ln -s srvsearch.1 sync_httpsearch.1
41-	cd $(INSTALL_MAN_DIR)/man1 && ln -s srvsearch.1 ruli-getaddrinfo.1
42-	cd $(INSTALL_MAN_DIR)/man1 && ln -s srvsearch.1 getaddrinfo.1
43+	cd $(INSTALL_MAN_DIR)/man1 && ln -sf srvsearch.1 smtpsearch.1
44+	cd $(INSTALL_MAN_DIR)/man1 && ln -sf srvsearch.1 httpsearch.1
45+	cd $(INSTALL_MAN_DIR)/man1 && ln -sf srvsearch.1 sync_srvsearch.1
46+	cd $(INSTALL_MAN_DIR)/man1 && ln -sf srvsearch.1 sync_smtpsearch.1
47+	cd $(INSTALL_MAN_DIR)/man1 && ln -sf srvsearch.1 sync_httpsearch.1
48+	cd $(INSTALL_MAN_DIR)/man1 && ln -sf srvsearch.1 ruli-getaddrinfo.1
49+	cd $(INSTALL_MAN_DIR)/man1 && ln -sf srvsearch.1 getaddrinfo.1
50
51 %.o: %.c
52 	$(CC) $(ARCH) $(CPPFLAGS) $(CFLAGS) -c $<
53diff --git a/src/Makefile b/src/Makefile
54index 9b56b5e..39a5ea1 100644
55--- a/src/Makefile
56+++ b/src/Makefile
57@@ -45,7 +45,7 @@ endif
58
59 WARN = -pedantic -ansi -Wshadow -Wpointer-arith -Wcast-qual \
60 	-Wcast-align -Wwrite-strings -Wredundant-decls
61-CC = gcc
62+CC ?= gcc
63
64 # gcc-specific options (not valid for g++)
65 ifeq ($(CC),gcc)
66@@ -58,7 +58,7 @@ SHARED = -fPIC
67 FLAGS = $(DEBUG) -O2 -pipe -Wall -g -shared -D_REENTRANT \
68         $(DEFINE_SOLARIS) -I. -I$(OOP_INCLUDE_DIR)
69 SOFT_CFLAGS = $(WARN) $(FLAGS)
70-CFLAGS = $(WARN) -Werror $(FLAGS)
71+CFLAGS += $(WARN) -Werror $(FLAGS)
72 LIBOBJ = ruli_isaac.o ruli_mem.o ruli_rand.o ruli_util.o ruli_list.o \
73 	ruli_addr.o ruli_sock.o ruli_txt.o ruli_msg.o ruli_fsm.o \
74 	ruli_res.o ruli_parse.o ruli_host.o ruli_srv.o ruli_conf.o \
75@@ -66,7 +66,7 @@ LIBOBJ = ruli_isaac.o ruli_mem.o ruli_rand.o ruli_util.o ruli_list.o \
76 	ruli_getaddrinfo.o
77 SHAREDOBJ = $(LIBOBJ:%.o=%.os)
78 SONAME = libruli.so.4
79-LDFLAGS = -L$(OOP_LIB_DIR)
80+LDFLAGS += -L$(OOP_LIB_DIR)
81
82 COMPILE = $(CC) $(ARCH) $(CPPFLAGS) $(CFLAGS) -c
83 SHARED_COMPILE = $(CC) $(ARCH) $(CPPFLAGS) $(SHARED) $(CFLAGS) -o $@ -c
84@@ -95,7 +95,7 @@ install: ruli
85 	cp $(SONAME) libruli.a $(INSTALL_LIB_DIR)
86 	cp *.h $(INSTALL_INCLUDE_DIR)
87 	cp ../doc/man/*.3 $(INSTALL_MAN3_DIR)
88-	cd $(INSTALL_LIB_DIR) && ln -s $(SONAME) libruli.so
89+	cd $(INSTALL_LIB_DIR) && ln -sf $(SONAME) libruli.so
90 	@echo
91 	@echo "REMINDER:"
92 	@echo "Add $(INSTALL_LIB_DIR) to your dynamic loader path:"
93--
942.24.0
95
96