Browse code

- makefile cleanups/fixes backported - cpl-c makefile fixes, warnings and include typo

Andrei Pelinescu-Onciul authored on 03/06/2005 00:56:20
Showing 3 changed files
... ...
@@ -237,6 +237,7 @@ mk-install-dirs: $(cfg-prefix)/$(cfg-dir) $(bin-prefix)/$(bin-dir) \
237 237
 			$(modules-prefix)/$(modules-dir) $(doc-prefix)/$(doc-dir) \
238 238
 			$(man-prefix)/$(man-dir)/man8 $(man-prefix)/$(man-dir)/man5
239 239
 
240
+
240 241
 $(cfg-prefix)/$(cfg-dir): 
241 242
 		mkdir -p $(cfg-prefix)/$(cfg-dir)
242 243
 
... ...
@@ -38,6 +38,7 @@
38 38
 #  2004-12-15  HAVE_ALLOCA_H added (andrei)
39 39
 #  2004-12-19  amd64 transformed in x86_64 (andrei)
40 40
 #  2005-04-27  alpha support added (andrei)
41
+#  2005-06-01  use $(LOCALBASE) instead of /usr/{local,pkg} (andrei)
41 42
 
42 43
 
43 44
 # check if already included/exported
... ...
@@ -70,59 +71,66 @@ ifneq ($(TLS),)
70 71
 endif
71 72
 # extra CC command line options (e.g  -march=athlon-mp)
72 73
 CC_EXTRA_OPTS ?=
73
- # install location
74
-DESTDIR ?= /usr/local
75
-PREFIX ?= $(DESTDIR)
76
-LOCALBASE ?= /usr/local
77
-prefix = $(PREFIX)
78
-# install path is $(basedir) $(prefix) 
79
-# example:
80
-#  creating a bin. archive in /tmp, which unpacks in /usr/local
81
-#  basedir=/tmp
82
-#  prefix=/usr/local
83
-
84
-BASEDIR ?=
85
-basedir = $(BASEDIR)
86
-# install prefixes for various stuff
87
-cfg-prefix = $(basedir)$(prefix)
88
-bin-prefix = $(basedir)$(prefix)
89
-modules-prefix = $(basedir)$(prefix)
90
-doc-prefix = $(basedir)$(prefix)
91
-man-prefix = $(basedir)$(prefix)
92
-ut-prefix = $(basedir)$(prefix)
93 74
 
94
-# dirs
75
+# dirs 
95 76
 cfg-dir = etc/ser/
96 77
 bin-dir = sbin/
97 78
 modules-dir = lib/ser/modules/
98 79
 ifeq ($(OS), linux)
99 80
 	doc-dir = share/doc/ser/
100 81
 	man-dir = share/man/
82
+	LOCALBASE ?= /usr/local
101 83
 else
102 84
 ifeq ($(OS), freebsd)
103 85
 	doc-dir = share/doc/ser/
104 86
 	man-dir = man/
87
+	LOCALBASE ?= /usr/local
105 88
 else
106 89
 ifeq ($(OS), openbsd)
107 90
 	doc-dir = share/doc/ser/
108 91
 	man-dir = man/
92
+	LOCALBASE ?= /usr/local
109 93
 else
110 94
 ifeq ($(OS), netbsd)
111 95
 	doc-dir = share/doc/ser
112 96
 	man-dir = man/
97
+	LOCALBASE ?= /usr/pkg
113 98
 else
114 99
 ifeq ($(OS), darwin)
115 100
 	doc-dir = share/doc/ser/
116 101
 	man-dir = man/
102
+	LOCALBASE ?= /usr/local
117 103
 else
118 104
 	doc-dir = doc/ser/
119 105
 	man-dir = man/
106
+	LOCALBASE ?= /usr/local
120 107
 endif
121 108
 endif
122 109
 endif
123 110
 endif
124 111
 endif
125
-ut-prefix = bin/
112
+
113
+ # install location
114
+DESTDIR ?= $(LOCALBASE)
115
+PREFIX ?= $(DESTDIR)
116
+prefix = $(PREFIX)
117
+# install path is $(basedir) $(prefix) 
118
+# example:
119
+#  creating a bin. archive in /tmp, which unpacks in /usr/local
120
+#  basedir=/tmp
121
+#  prefix=/usr/local
122
+
123
+BASEDIR ?=
124
+basedir = $(BASEDIR)
125
+# install prefixes for various stuff
126
+cfg-prefix = $(basedir)$(prefix)
127
+bin-prefix = $(basedir)$(prefix)
128
+modules-prefix = $(basedir)$(prefix)
129
+doc-prefix = $(basedir)$(prefix)
130
+man-prefix = $(basedir)$(prefix)
131
+ut-prefix = $(basedir)$(prefix)
132
+
133
+
126 134
 # target dirs for various stuff
127 135
 cfg-target = $(prefix)/$(cfg-dir)
128 136
 bin-target = $(prefix)/$(bin-dir)
... ...
@@ -862,7 +870,7 @@ ifeq ($(CC_NAME), suncc)
862 870
 endif
863 871
 	OLD_SOLARIS= $(shell echo "$(OSREL)" | \
864 872
 				sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
865
-	LIBS+= -L/usr/local/lib -lfl -lxnet -lnsl 
873
+	LIBS+= -L$(LOCALBASE)/lib -lfl -lxnet -lnsl 
866 874
 ifeq	($(OLD_SOLARIS), yes)
867 875
 		LIBS+=-lposix4
868 876
 else
... ...
@@ -954,7 +962,8 @@ endif
954 962
 
955 963
 #add libssl if needed
956 964
 ifneq ($(TLS),)
957
-LIBS+= -L/usr/local/lib -L/usr/local/ssl/lib -lssl  -lcrypto
965
+DEFS+= -I$(LOCALBASE)/ssl/include
966
+LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl  -lcrypto
958 967
 endif
959 968
 
960 969
 ifneq ($(found_lock_method), yes)
... ...
@@ -41,12 +41,15 @@ static: $(objs)
41 41
 clean: 
42 42
 	-@rm -f $(objs) $(NAME) $(objs:.o=.il) 2>/dev/null
43 43
 	-@for r in $(modules) $(static_modules_path) "" ; do \
44
-		if [ -n "$$r" ]; then \
44
+		if [ -d "$$r" ]; then \
45 45
 			echo "module $$r" ; \
46 46
 			$(MAKE) -C $$r clean ; \
47 47
 		fi ; \
48 48
 	done
49
-	@if [ -n "$(modules)" ]; then cd utils/gen_ha1; $(MAKE) clean; cd ../serunix; $(MAKE) clean; fi
49
+	@if [ -n "$(modules)" -a -d utils/gen_ha1 ]; then \
50
+		cd utils/gen_ha1; $(MAKE) clean; \
51
+		cd ../serunix; $(MAKE) clean; \
52
+	fi
50 53
 
51 54
 .PHONY: proper
52 55
 .PHONY: distclean
... ...
@@ -54,7 +57,7 @@ clean:
54 57
 proper realclean distclean: clean 
55 58
 	-@rm -f $(depends) $(auto_gen) 2>/dev/null
56 59
 	-@for r in $(modules) "" ; do \
57
-		if [ -n "$$r" ]; then \
60
+		if [ -d "$$r" ]; then \
58 61
 			 $(MAKE) -C $$r proper ; \
59 62
 		fi ; \
60 63
 	done 
... ...
@@ -63,7 +66,7 @@ proper realclean distclean: clean
63 66
 mantainer-clean: distclean
64 67
 	-rm -f TAGS tags *.dbg .*.swp
65 68
 	-@for r in $(modules) "" ; do \
66
-		if [ -n "$$r" ]; then \
69
+		if [ -d "$$r" ]; then \
67 70
 			$(MAKE) -C $$r mantainer-clean; \
68 71
 		fi ; \
69 72
 	 done