More work on the new build system. I think this will work out fine actually, but I can't test without deploying >:(
This commit is contained in:
parent
58d160b0ca
commit
eb22f253b2
|
@ -1,7 +1,6 @@
|
||||||
# 16 october 2015
|
# 16 october 2015
|
||||||
|
|
||||||
# TODO http://stackoverflow.com/questions/4122831/disable-make-builtin-rules-and-variables-from-inside-the-make-file
|
# TODO http://stackoverflow.com/questions/4122831/disable-make-builtin-rules-and-variables-from-inside-the-make-file
|
||||||
# TODO and figure out what variables are predefined
|
|
||||||
|
|
||||||
# silence entering/leaving messages
|
# silence entering/leaving messages
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
@ -30,35 +29,32 @@ ifndef NODEBUG
|
||||||
NODEBUG = 0
|
NODEBUG = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# TODO $(CC), $(CXX)? if so, $(LD)?
|
# parameters
|
||||||
# TODO quotes for the FLAGS options?
|
export OS
|
||||||
# TODO use export instead - http://stackoverflow.com/questions/2826029/passing-additional-variables-from-command-line-to-make
|
# TODO CC, CXX, RC, CVTRES, LD
|
||||||
ARGS = \
|
export CFLAGS
|
||||||
OS=$(OS) \
|
export CXXFLAGS
|
||||||
OUTDIR=$(OUTDIR) \
|
# TODO RCFLAGS, CVTRESFLAGS
|
||||||
OBJDIR=$(OBJDIR) \
|
export LDFLAGS
|
||||||
CFLAGS=$(CFLAGS) \
|
export NODEBUG
|
||||||
CXXFLAGS=$(CXXFLAGS) \
|
export EXAMPLE
|
||||||
LDFLAGS=$(LDFLAGS) \
|
|
||||||
NODEBUG=$(NODEBUG) \
|
|
||||||
inlibuibuild=1
|
|
||||||
|
|
||||||
real:
|
# other important variables
|
||||||
@echo $(MAKE)
|
export OBJDIR
|
||||||
@echo $(ARGS)
|
export OUTDIR
|
||||||
|
|
||||||
libui:
|
libui:
|
||||||
@$(MAKE) -f build/GNUmakefile.libui $(ARGS)
|
@$(MAKE) -f build/GNUmakefile.libui inlibuibuild=1
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(OBJDIR) $(OUTDIR)
|
rm -rf $(OBJDIR) $(OUTDIR)
|
||||||
|
|
||||||
test: libui
|
test: libui
|
||||||
@$(MAKE) -f build/GNUmakefile.test $(ARGS)
|
@$(MAKE) -f build/GNUmakefile.test inlibuibuild=1
|
||||||
|
|
||||||
# TODO provide a build option for the queuemaintest
|
# TODO provide a build option for the queuemaintest
|
||||||
|
|
||||||
example: libui
|
example: libui
|
||||||
@$(MAKE) -f build/GNUmakefile.example $(ARGS) EXAMPLE=$(EXAMPLE)
|
@$(MAKE) -f build/GNUmakefile.example inlibuibuild=1
|
||||||
|
|
||||||
# TODO examples rule?
|
# TODO examples rule?
|
||||||
|
|
|
@ -1,5 +1,32 @@
|
||||||
# 16 october 2015
|
# 16 october 2015
|
||||||
|
|
||||||
|
# Global flags.
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-fPIC \
|
||||||
|
-Wall -Wextra -pedantic \
|
||||||
|
-Wno-unused-parameter \
|
||||||
|
-Wno-switch \
|
||||||
|
--std=c99
|
||||||
|
|
||||||
|
# C++11 is needed due to stupid rules involving commas at the end of enum lists that C++03 stupidly didn't follow
|
||||||
|
# This means sorry, no GCC 2 for Haiku builds :(
|
||||||
|
CXXFLAGS += \
|
||||||
|
-fPIC \
|
||||||
|
-Wall -Wextra -pedantic \
|
||||||
|
-Wno-unused-parameter \
|
||||||
|
-Wno-switch \
|
||||||
|
--std=c++11
|
||||||
|
|
||||||
|
LDFLAGS += \
|
||||||
|
-fPIC
|
||||||
|
|
||||||
|
ifneq ($(NODEBUG),1)
|
||||||
|
CFLAGS += -g
|
||||||
|
CXXFLAGS += -g
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
OFILES = \
|
OFILES = \
|
||||||
$(subst /,_,$(CFILES)) \
|
$(subst /,_,$(CFILES)) \
|
||||||
$(subst /,_,$(CXXFILES)) \
|
$(subst /,_,$(CXXFILES)) \
|
||||||
|
@ -8,35 +35,12 @@ OFILES = \
|
||||||
|
|
||||||
OFILES := $(OFILES:%=$(OBJDIR)/%.o)
|
OFILES := $(OFILES:%=$(OBJDIR)/%.o)
|
||||||
|
|
||||||
CFLAGS += \
|
|
||||||
-g \
|
|
||||||
-Wall -Wextra -pedantic \
|
|
||||||
-Wno-unused-parameter \
|
|
||||||
-Wno-switch \
|
|
||||||
--std=c99
|
|
||||||
|
|
||||||
# C++11 is needed due to stupid rules involving commas at the end of enum lists that C++03 stupidly didn't follow
|
|
||||||
# This means sorry, no GCC 2 for Haiku builds :(
|
|
||||||
CXXFLAGS += \
|
|
||||||
-g \
|
|
||||||
-Wall -Wextra -pedantic \
|
|
||||||
-Wno-unused-parameter \
|
|
||||||
-Wno-switch \
|
|
||||||
--std=c++11
|
|
||||||
|
|
||||||
LDFLAGS += \
|
|
||||||
-g
|
|
||||||
|
|
||||||
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
|
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
|
||||||
|
|
||||||
ifdef CXXFILES
|
# TODO make the linker the C++ compiler in a C++ build if needed
|
||||||
reallinker = $(CXX)
|
|
||||||
else
|
|
||||||
reallinker = $(CC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(OUT): $(OFILES) | $(OUTDIR)
|
$(OUT): $(OFILES) | $(OUTDIR)
|
||||||
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
|
@$(LD) -o $(OUT) $(OFILES) $(LDFLAGS)
|
||||||
@echo ====== Linked $(OUT)
|
@echo ====== Linked $(OUT)
|
||||||
|
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
|
@ -53,13 +57,11 @@ $(OBJDIR)/%.m.o: $$(subst _,/,%).m $(HFILES) | $(OBJDIR)
|
||||||
@$(CC) -o $@ -c $< $(CFLAGS)
|
@$(CC) -o $@ -c $< $(CFLAGS)
|
||||||
@echo ====== Compiled $<
|
@echo ====== Compiled $<
|
||||||
|
|
||||||
|
# TODO split into $(RC) and $(CVTRES) forms
|
||||||
|
# with binutils windres can either go straight to a .o file or in the normal two steps
|
||||||
$(OBJDIR)/%.rc.o: $$(subst _,/,%).rc $(HFILES) | $(OBJDIR)
|
$(OBJDIR)/%.rc.o: $$(subst _,/,%).rc $(HFILES) | $(OBJDIR)
|
||||||
@$(RC) $(RCFLAGS) $< $@
|
@$(RC) $(RCFLAGS) $< $@
|
||||||
@echo ====== Compiled $<
|
@echo ====== Compiled $<
|
||||||
|
|
||||||
$(OBJDIR) $(OUTDIR):
|
$(OBJDIR) $(OUTDIR):
|
||||||
@mkdir -p $@
|
@mkdir -p $@
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(OBJDIR) $(OUTDIR)
|
|
||||||
.PHONY: clean
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
# 16 october 2015
|
||||||
|
|
||||||
|
ifndef inlibuibuild
|
||||||
|
$(error Do not run these makefiles directly.)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# for GCC
|
||||||
|
SOVERSION = 0
|
||||||
|
|
||||||
|
include $(OS)/GNUosspecific.mk
|
||||||
|
include common/GNUfiles.mk
|
||||||
|
include $(OS)/GNUfiles.mk
|
||||||
|
|
||||||
|
HFILES += \
|
||||||
|
ui.h \
|
||||||
|
ui_$(OS)$(OSHSUFFIX)
|
||||||
|
|
||||||
|
NAME = libui
|
||||||
|
SUFFIX = $(LIBSUFFIX)
|
||||||
|
|
||||||
|
ifeq ($(TOOLCHAIN),gcc)
|
||||||
|
# make every symbol hidden by default except _UI_EXTERN ones
|
||||||
|
# thanks ebassi in irc.gimp.net/#gtk+
|
||||||
|
CFLAGS += \
|
||||||
|
-D_UI_EXTERN='__attribute__((visibility("default"))) extern' \
|
||||||
|
-fvisibility=hidden
|
||||||
|
CXXFLAGS += \
|
||||||
|
-D_UI_EXTERN='__attribute__((visibility("default"))) extern' \
|
||||||
|
-fvisibility=hidden
|
||||||
|
LDFLAGS += \
|
||||||
|
-fvisibility=hidden
|
||||||
|
else
|
||||||
|
# TODO
|
||||||
|
endif
|
||||||
|
|
||||||
|
include build/GNUbase$(TOOLCHAIN).mk
|
|
@ -31,18 +31,19 @@ CFILES += \
|
||||||
HFILES += \
|
HFILES += \
|
||||||
unix/uipriv_unix.h
|
unix/uipriv_unix.h
|
||||||
|
|
||||||
# thanks ebassi in irc.gimp.net/#gtk+
|
# TODO split into a separate file or put in GNUmakefile.libui somehow?
|
||||||
CFLAGS += \
|
|
||||||
-D_UI_EXTERN='__attribute__((visibility("default"))) extern' \
|
|
||||||
-fvisibility=hidden \
|
|
||||||
-fPIC \
|
|
||||||
`pkg-config --cflags gtk+-3.0`
|
|
||||||
|
|
||||||
|
# flags for building a shared library
|
||||||
|
# OS X does support -shared but it has a preferred name for this so let's use that there instead; hence this is not gcc-global
|
||||||
LDFLAGS += \
|
LDFLAGS += \
|
||||||
-fvisibility=hidden \
|
-shared
|
||||||
-fPIC \
|
|
||||||
`pkg-config --libs gtk+-3.0` -lm
|
|
||||||
|
|
||||||
# flags for warning on undefined symbols
|
# flags for warning on undefined symbols
|
||||||
|
# this is not gcc-global because OS X doesn't support these flags
|
||||||
LDFLAGS += \
|
LDFLAGS += \
|
||||||
-Wl,--no-undefined -Wl,--no-allow-shlib-undefined
|
-Wl,--no-undefined -Wl,--no-allow-shlib-undefined
|
||||||
|
|
||||||
|
# flags for setting soname
|
||||||
|
# this is not gcc-global because OS X uses a different filename format
|
||||||
|
LDFLAGS += \
|
||||||
|
-Wl,-soname,$(NAME)$(SUFFIX).$(SOVERSION)
|
|
@ -3,3 +3,4 @@
|
||||||
EXESUFFIX =
|
EXESUFFIX =
|
||||||
LIBSUFFIX = .so
|
LIBSUFFIX = .so
|
||||||
OSHSUFFIX = .h
|
OSHSUFFIX = .h
|
||||||
|
TOOLCHAIN = gcc
|
|
@ -1,31 +0,0 @@
|
||||||
# 16 october 2015
|
|
||||||
|
|
||||||
ifndef inlibuibuild
|
|
||||||
$(error [FAIL] do not run these makefiles directly)
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(OS)/GNUosspecific.mk
|
|
||||||
include common/GNUmakeinc.mk
|
|
||||||
include $(OS)/GNUmakeinc.mk
|
|
||||||
|
|
||||||
HFILES += \
|
|
||||||
ui.h \
|
|
||||||
ui_$(OS)$(OSHSUFFIX)
|
|
||||||
|
|
||||||
NAME = libui
|
|
||||||
|
|
||||||
# GROAN GCC
|
|
||||||
#CFLAGS += \
|
|
||||||
# -fPIC
|
|
||||||
|
|
||||||
SUFFIX = $(LIBSUFFIX)
|
|
||||||
|
|
||||||
LDFLAGS += \
|
|
||||||
-shared
|
|
||||||
# weird things:
|
|
||||||
# GROAN GCC
|
|
||||||
# -fPIC \
|
|
||||||
# confused by this
|
|
||||||
# -Wl,-soname,$(NAME)$(SUFFIX).0
|
|
||||||
|
|
||||||
include GNUbaserules.mk
|
|
Loading…
Reference in New Issue