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
|
||||
|
||||
# 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
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
@ -30,35 +29,32 @@ ifndef NODEBUG
|
|||
NODEBUG = 0
|
||||
endif
|
||||
|
||||
# TODO $(CC), $(CXX)? if so, $(LD)?
|
||||
# TODO quotes for the FLAGS options?
|
||||
# TODO use export instead - http://stackoverflow.com/questions/2826029/passing-additional-variables-from-command-line-to-make
|
||||
ARGS = \
|
||||
OS=$(OS) \
|
||||
OUTDIR=$(OUTDIR) \
|
||||
OBJDIR=$(OBJDIR) \
|
||||
CFLAGS=$(CFLAGS) \
|
||||
CXXFLAGS=$(CXXFLAGS) \
|
||||
LDFLAGS=$(LDFLAGS) \
|
||||
NODEBUG=$(NODEBUG) \
|
||||
inlibuibuild=1
|
||||
# parameters
|
||||
export OS
|
||||
# TODO CC, CXX, RC, CVTRES, LD
|
||||
export CFLAGS
|
||||
export CXXFLAGS
|
||||
# TODO RCFLAGS, CVTRESFLAGS
|
||||
export LDFLAGS
|
||||
export NODEBUG
|
||||
export EXAMPLE
|
||||
|
||||
real:
|
||||
@echo $(MAKE)
|
||||
@echo $(ARGS)
|
||||
# other important variables
|
||||
export OBJDIR
|
||||
export OUTDIR
|
||||
|
||||
libui:
|
||||
@$(MAKE) -f build/GNUmakefile.libui $(ARGS)
|
||||
@$(MAKE) -f build/GNUmakefile.libui inlibuibuild=1
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR) $(OUTDIR)
|
||||
|
||||
test: libui
|
||||
@$(MAKE) -f build/GNUmakefile.test $(ARGS)
|
||||
@$(MAKE) -f build/GNUmakefile.test inlibuibuild=1
|
||||
|
||||
# TODO provide a build option for the queuemaintest
|
||||
|
||||
example: libui
|
||||
@$(MAKE) -f build/GNUmakefile.example $(ARGS) EXAMPLE=$(EXAMPLE)
|
||||
@$(MAKE) -f build/GNUmakefile.example inlibuibuild=1
|
||||
|
||||
# TODO examples rule?
|
||||
|
|
|
@ -1,5 +1,32 @@
|
|||
# 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 = \
|
||||
$(subst /,_,$(CFILES)) \
|
||||
$(subst /,_,$(CXXFILES)) \
|
||||
|
@ -8,35 +35,12 @@ OFILES = \
|
|||
|
||||
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)
|
||||
|
||||
ifdef CXXFILES
|
||||
reallinker = $(CXX)
|
||||
else
|
||||
reallinker = $(CC)
|
||||
endif
|
||||
# TODO make the linker the C++ compiler in a C++ build if needed
|
||||
|
||||
$(OUT): $(OFILES) | $(OUTDIR)
|
||||
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
|
||||
@$(LD) -o $(OUT) $(OFILES) $(LDFLAGS)
|
||||
@echo ====== Linked $(OUT)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
|
@ -53,13 +57,11 @@ $(OBJDIR)/%.m.o: $$(subst _,/,%).m $(HFILES) | $(OBJDIR)
|
|||
@$(CC) -o $@ -c $< $(CFLAGS)
|
||||
@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)
|
||||
@$(RC) $(RCFLAGS) $< $@
|
||||
@echo ====== Compiled $<
|
||||
|
||||
$(OBJDIR) $(OUTDIR):
|
||||
@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 += \
|
||||
unix/uipriv_unix.h
|
||||
|
||||
# thanks ebassi in irc.gimp.net/#gtk+
|
||||
CFLAGS += \
|
||||
-D_UI_EXTERN='__attribute__((visibility("default"))) extern' \
|
||||
-fvisibility=hidden \
|
||||
-fPIC \
|
||||
`pkg-config --cflags gtk+-3.0`
|
||||
# TODO split into a separate file or put in GNUmakefile.libui somehow?
|
||||
|
||||
# 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 += \
|
||||
-fvisibility=hidden \
|
||||
-fPIC \
|
||||
`pkg-config --libs gtk+-3.0` -lm
|
||||
-shared
|
||||
|
||||
# flags for warning on undefined symbols
|
||||
# this is not gcc-global because OS X doesn't support these flags
|
||||
LDFLAGS += \
|
||||
-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 =
|
||||
LIBSUFFIX = .so
|
||||
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