Set up the new Unix build. Now to do the OS X build.

This commit is contained in:
Pietro Gagliardi 2015-12-11 18:37:15 -05:00
parent eb22f253b2
commit acf3b3564e
7 changed files with 18 additions and 2 deletions

View File

@ -27,6 +27,8 @@ ifneq ($(NODEBUG),1)
LDFLAGS += -g
endif
# Build rules.
OFILES = \
$(subst /,_,$(CFILES)) \
$(subst /,_,$(CXXFILES)) \
@ -37,10 +39,16 @@ OFILES := $(OFILES:%=$(OBJDIR)/%.o)
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
# TODO make the linker the C++ compiler in a C++ build if needed
# TODO allow using LD
# LD is defined by default so we need a way to override the default define without blocking a user define
ifeq ($(CXXFILES),)
reallinker = $(CC)
else
reallinker = $(CXX)
endif
$(OUT): $(OFILES) | $(OUTDIR)
@$(LD) -o $(OUT) $(OFILES) $(LDFLAGS)
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
@echo ====== Linked $(OUT)
.SECONDEXPANSION:

View File

@ -33,6 +33,14 @@ HFILES += \
# TODO split into a separate file or put in GNUmakefile.libui somehow?
# flags for GTK+
CFLAGS += \
`pkg-config --cflags gtk+-3.0`
CXXFLAGS += \
`pkg-config --cflags gtk+-3.0`
LDFLAGS += \
`pkg-config --libs gtk+-3.0` -lm
# 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 += \