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.
This commit is contained in:
parent
a788f80a92
commit
b40ad26544
12
src/Makefile
12
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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue