More makefile work.

This commit is contained in:
Pietro Gagliardi 2015-10-16 22:49:54 -04:00
parent e04e5dc90f
commit f19d3cd0c7
10 changed files with 44 additions and 59 deletions

View File

@ -1,8 +1,5 @@
# 16 october 2015
OUTDIR = out
OBJDIR = .obj
OFILES = \
$(subst /,_,$(CFILES)) \
$(subst /,_,$(MFILES)) \

View File

@ -3,6 +3,9 @@
# silence entering/leaving messages
MAKEFLAGS += --no-print-directory
OUTDIR = out
OBJDIR = .obj
# MAME does this so :/
ifeq ($(OS),Windows_NT)
OS = windows
@ -29,10 +32,10 @@ ifndef ARCH
endif
libui:
@$(MAKE) -f GNUmakefile.libui OS=$(OS) ARCH=$(ARCH)
@$(MAKE) -f GNUmakefile.libui OS=$(OS) ARCH=$(ARCH) OUTDIR=$(OUTDIR) OBJDIR=$(OBJDIR)
clean:
@$(MAKE) -f GNUmakefile.libui OS=$(OS) ARCH=$(ARCH) clean
@$(MAKE) -f GNUmakefile.libui OS=$(OS) ARCH=$(ARCH) OUTDIR=$(OUTDIR) OBJDIR=$(OBJDIR) clean
test: libui
@$(MAKE) -f GNUmakefile.test OS=$(OS) ARCH=$(ARCH)
@$(MAKE) -f GNUmakefile.test OS=$(OS) ARCH=$(ARCH) OUTDIR=$(OUTDIR) OBJDIR=$(OBJDIR)

View File

@ -1,5 +1,6 @@
# 16 october 2015
include $(OS)/GNUosspecific.mk
include common/GNUmakeinc.mk
include $(OS)/GNUmakeinc.mk
@ -12,6 +13,8 @@ NAME = libui
CFLAGS += \
-fPIC
SUFFIX = $(LIBSUFFIX)
LDFLAGS += \
-shared \
-fPIC \

View File

@ -1,5 +1,6 @@
# 16 october 2015
include $(OS)/GNUosspecific.mk
include test/GNUmakeinc.mk
HFILES += \
@ -7,35 +8,10 @@ HFILES += \
NAME = test
SUFFIX =
ifeq ($(OS),windows)
SUFFIX = .exe
endif
SUFFIX = $(EXESUFFIX)
# TODO split out this logic somehow
ifeq ($(OS),windows)
ifeq ($(ARCH),amd64)
ifndef CC
CC = x86_64-w64-mingw32-gcc
endif
ifndef RC
RC = x86_64-w64-mingw32-windres
endif
else ifeq ($(ARCH),386)
ifndef CC
CC = i686-w64-mingw32-gcc
endif
ifndef RC
RC = i686-w64-mingw32-windres
endif
else ifneq ($(ARCH),default)
$(error [FAIL] unknown architecture $(ARCH))
endif
LDFLAGS += out/libui.dll
else ifeq ($(OS),darwin)
LDFLAGS += out/libui.dylib
else
LDFLAGS += out/libui.so
endif
# TODO what's the difference between doing this and linking to out/libui.so directly?
# LDFLAGS += -L$(OUTDIR) -lui
LDFLAGS += $(OUTDIR)/libui$(LIBSUFFIX)
include GNUbaserules.mk

View File

@ -48,5 +48,3 @@ LDFLAGS += \
# on warning about undefined symbols:
# the gcc flags don't work with Apple's linker
# fortunately, we don't need any; Apple's linker warns about undefined symbols in -shared builds!
SUFFIX = .dylib

4
darwin/GNUosspecific.mk Normal file
View File

@ -0,0 +1,4 @@
# 16 october 2015
EXESUFFIX =
LIBSUFFIX = .dylib

View File

@ -45,5 +45,3 @@ LDFLAGS += \
# flags for warning on undefined symbols
LDFLAGS += \
-Wl,--no-undefined -Wl,--no-allow-shlib-undefined
SUFFIX = .so

4
unix/GNUosspecific.mk Normal file
View File

@ -0,0 +1,4 @@
# 16 october 2015
EXESUFFIX =
LIBSUFFIX = .so

View File

@ -56,23 +56,3 @@ LDFLAGS += \
# warnings on undefined symbols
LDFLAGS += \
-Wl,--no-undefined -Wl,--no-allow-shlib-undefined
SUFFIX = .dll
ifeq ($(ARCH),amd64)
ifndef CC
CC = x86_64-w64-mingw32-gcc
endif
ifndef RC
RC = x86_64-w64-mingw32-windres
endif
else ifeq ($(ARCH),386)
ifndef CC
CC = i686-w64-mingw32-gcc
endif
ifndef RC
RC = i686-w64-mingw32-windres
endif
else ifneq ($(ARCH),default)
$(error [FAIL] unknown architecture $(ARCH))
endif

22
windows/GNUosspecific.mk Normal file
View File

@ -0,0 +1,22 @@
# 16 october 2015
EXESUFFIX = .exe
LIBSUFFIX = .dll
ifeq ($(ARCH),amd64)
ifndef CC
CC = x86_64-w64-mingw32-gcc
endif
ifndef RC
RC = x86_64-w64-mingw32-windres
endif
else ifeq ($(ARCH),386)
ifndef CC
CC = i686-w64-mingw32-gcc
endif
ifndef RC
RC = i686-w64-mingw32-windres
endif
else ifneq ($(ARCH),default)
$(error [FAIL] unknown architecture $(ARCH))
endif