about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-24 09:27:07 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-24 09:28:01 -0800
commitb40ad265448018d1a22d67db399568a2dfaf3cd2 (patch)
treecfcd0ff11c8f4c803cafdada16836cad065da5d6
parenta788f80a92d3942d57036e7f9c3816c89111cc0a (diff)
downloadteliva-b40ad265448018d1a22d67db399568a2dfaf3cd2.tar.gz
more Makefile streamlining
Since everything is in my control there's no need to parameterize
include paths.

It's a struggle to get make to run when it should. Lying that something
is phony stops working when it's a dependency. Commands get
unnecessarily run. Just fucking run recursive makes directly in the
target that depends on them.
-rw-r--r--src/Makefile12
-rw-r--r--src/luasec/Makefile22
-rw-r--r--src/luasocket/makefile2
3 files changed, 17 insertions, 19 deletions
diff --git a/src/Makefile b/src/Makefile
index 1d36c93..5bb7761 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -53,18 +53,14 @@ $(LUA_A): $(CORE_O) $(LIB_O)
 	$(AR) $@ $(CORE_O) $(LIB_O)
 	$(RANLIB) $@
 
-$(LUA_T): $(LUA_O) $(LUA_A) luasocket/socket.a luasocket/mime.a luasec/ssl.a
+$(LUA_T): $(LUA_O) $(LUA_A)
+	make -C luasocket linux
+	make -C luasec linux
 	$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) luasocket/socket.a luasocket/mime.a luasec/ssl.a $(LIBS)
 
 $(LUAC_T): $(LUAC_O) $(LUA_A)
 	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
 
-luasocket/socket.a luasocket/mime.a:
-	make -C luasocket linux
-
-luasec/ssl.a:
-	make -C luasec linux
-
 clean:
 	make -C luasocket clean
 	make -C luasec clean
@@ -126,7 +122,7 @@ solaris:
 	$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl"
 
 # list targets that do not create files (but not all makes understand .PHONY)
-.PHONY: all $(PLATS) default o a clean depend echo none luasocket/socket.a luasocket/mime.a luasec/ssl.a
+.PHONY: all $(PLATS) default o a clean depend echo none
 
 # DO NOT DELETE
 
diff --git a/src/luasec/Makefile b/src/luasec/Makefile
index c495109..c3ae3c6 100644
--- a/src/luasec/Makefile
+++ b/src/luasec/Makefile
@@ -11,20 +11,19 @@ OBJS= \
 
 WARN=-Wall -Wpedantic -Wshadow
 
-BSD_CFLAGS=-O2 -fPIC $(WARN) $(INCDIR) $(DEFS)
-BSD_LDFLAGS=-O -fPIC -shared $(LIBDIR)
+BSD_CFLAGS=-O2 -fPIC $(WARN) $(DEFS)
+BSD_LDFLAGS=-O -fPIC -shared
 
-linux_CFLAGS=-g -O2 $(WARN) $(INCDIR) $(DEFS)
+linux_CFLAGS=-g -O2 $(WARN) $(DEFS)
 
 macosx_ENV=env MACOSX_DEPLOYMENT_TARGET='$(MACVER)'
-macosx_CFLAGS=-O2 -fno-common $(WARN) $(INCDIR) $(DEFS)
-macosx_LDFLAGS=-bundle -undefined dynamic_lookup $(LIBDIR)
+macosx_CFLAGS=-O2 -fno-common $(WARN) $(DEFS)
+macosx_LDFLAGS=-bundle -undefined dynamic_lookup
 
 INSTALL  = install
 CC      ?= gcc
 CCLD      ?= $(MYENV) $(CC)
-CFLAGS = $(linux_CFLAGS)
-CFLAGS  += $(MYCFLAGS)
+CFLAGS  = $(MYCFLAGS)
 LDFLAGS += $(MYLDFLAGS)
 AR= ar rc
 RANLIB= ranlib
@@ -39,9 +38,8 @@ install: $(CMOD) $(LMOD)
 	$(INSTALL) -m644 $(LMOD) $(DESTDIR)$(LUAPATH)
 	$(INSTALL) -m644 https.lua $(DESTDIR)$(LUAPATH)/ssl
 
-linux: $(OBJS)
-	$(AR) $(CMOD) $(OBJS)
-	$(RANLIB) $(CMOD)
+linux:
+	@$(MAKE) $(CMOD) MYCFLAGS="$(linux_CFLAGS)" MYLDFLAGS="$(linux_LDFLAGS)" EXTRA="$(EXTRA)"
 
 bsd:
 	@$(MAKE) $(CMOD) MYCFLAGS="$(BSD_CFLAGS)" MYLDFLAGS="$(BSD_LDFLAGS)" EXTRA="$(EXTRA)"
@@ -49,6 +47,10 @@ bsd:
 macosx:
 	@$(MAKE) $(CMOD) MYCFLAGS="$(macosx_CFLAGS)" MYLDFLAGS="$(macosx_LDFLAGS)" MYENV="$(macosx_ENV)" EXTRA="$(EXTRA)"
 
+$(CMOD): $(OBJS)
+	$(AR) $(CMOD) $(OBJS)
+	$(RANLIB) $(CMOD)
+
 clean:
 	rm -f $(OBJS) $(CMOD)
 
diff --git a/src/luasocket/makefile b/src/luasocket/makefile
index f6548d9..0772a2b 100644
--- a/src/luasocket/makefile
+++ b/src/luasocket/makefile
@@ -174,7 +174,7 @@ SO_linux=so
 O_linux=o
 CC_linux=gcc
 DEF_linux=-DLUASOCKET_$(DEBUG)
-CFLAGS_linux= -g -O2 -Wall -Wpedantic -Wshadow -Wextra $(LUAINC:%=-I%) $(DEF)
+CFLAGS_linux= -g -O2 -Wall -Wpedantic -Wshadow -Wextra $(DEF)
 LDFLAGS_linux= -o
 LD_linux=ld
 SOCKET_linux=usocket.o