Makefile tweaks

This commit is contained in:
2024-02-26 11:05:32 -06:00
parent 3ffd84e348
commit ae5e4b3419

View File

@@ -5,7 +5,7 @@ LIBFLAG := -shared
LIB_EXT := $(if $(filter Windows_NT,$(OS)),dll,so) LIB_EXT := $(if $(filter Windows_NT,$(OS)),dll,so)
LUA_INCDIR := /usr/include LUA_INCDIR := /usr/include
SRCDIR := . SRCDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
is_clang = $(filter %clang++,$(CXX)) is_clang = $(filter %clang++,$(CXX))
@@ -13,6 +13,9 @@ ifeq ($(OS),Windows_NT)
else else
uname_s := $(shell uname -s) uname_s := $(shell uname -s)
ifeq ($(uname_s),Darwin) ifeq ($(uname_s),Darwin)
CC := env MACOSX_DEPLOYMENT_TARGET=11.0 gcc
CXX := env MACOSX_DEPLOYMENT_TARGET=11.0 g++
LIBFLAG := -bundle -undefined dynamic_lookup
is_clang = 1 is_clang = 1
is_gcc = is_gcc =
else else
@@ -42,8 +45,6 @@ ifeq ($(origin LUAROCKS), command line)
endif endif
endif endif
luarocks: ljkiwi.$(LIB_EXT)
else else
CCFLAGS += -fPIC $(OPTFLAG) CCFLAGS += -fPIC $(OPTFLAG)
override CFLAGS += -std=c99 $(CCFLAGS) override CFLAGS += -std=c99 $(CCFLAGS)
@@ -87,13 +88,13 @@ ifeq ($(LUA_VERSION),5.1)
endif endif
endif endif
KIWI_LIB := AssocVector.h constraint.h debug.h errors.h expression.h kiwi.h maptype.h \ kiwi_lib_srcs := AssocVector.h constraint.h debug.h errors.h expression.h kiwi.h maptype.h \
row.h shareddata.h solver.h solverimpl.h strength.h symbol.h symbolics.h term.h \ row.h shareddata.h solver.h solverimpl.h strength.h symbol.h symbolics.h term.h \
util.h variable.h version.h util.h variable.h version.h
OBJS := luakiwi.o objs := luakiwi.o
ifdef LJKIWI_CKIWI ifdef LJKIWI_CKIWI
OBJS += ckiwi.o objs += ckiwi.o
endif endif
vpath %.cpp $(SRCDIR)/ckiwi $(SRCDIR)/luakiwi vpath %.cpp $(SRCDIR)/ckiwi $(SRCDIR)/luakiwi
@@ -106,17 +107,17 @@ install:
$(CP) -f kiwi.lua $(INST_LUADIR)/kiwi.lua $(CP) -f kiwi.lua $(INST_LUADIR)/kiwi.lua
mostlyclean: mostlyclean:
$(RM) -f ljkiwi.$(LIB_EXT) $(OBJS) $(RM) -f ljkiwi.$(LIB_EXT) $(objs)
clean: mostlyclean clean: mostlyclean
$(RM) -f $(PCH) $(RM) -f $(PCH)
ckiwi.o: $(PCH) ckiwi.cpp ckiwi.h $(KIWI_LIB) ckiwi.o: $(PCH) ckiwi.cpp ckiwi.h $(kiwi_lib_srcs)
luakiwi.o: $(PCH) luakiwi-int.h luacompat.h $(KIWI_LIB) luakiwi.o: $(PCH) luakiwi-int.h luacompat.h $(kiwi_lib_srcs)
$(PCH): $(KIWI_LIB) $(PCH): $(kiwi_lib_srcs)
ljkiwi.$(LIB_EXT): $(OBJS) ljkiwi.$(LIB_EXT): $(objs)
$(CXX) $(CCFLAGS) $(LIBFLAG) -o $@ $(OBJS) $(CXX) $(CCFLAGS) $(LIBFLAG) -o $@ $(objs)
%.hpp.gch: %.hpp %.hpp.gch: %.hpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -o $@ $< $(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -o $@ $<