Added Android targeted build support to the makefile

This commit is contained in:
Mark Pizzolato 2011-11-16 13:45:37 -08:00
parent 22b130be23
commit 2d4d248ae3

View file

@ -7,9 +7,10 @@
# NetBSD # NetBSD
# FreeBSD # FreeBSD
# Windows (MinGW & cygwin) # Windows (MinGW & cygwin)
# Linux x86 targeting Android (using agcc script)
# #
# # Android targeted builds should invoke GNU make with GCC=agcc on
# CC Command (and platform available options). (Poor man's autoconf) # the command line.
# #
# In general, the logic below will detect and build with the available # In general, the logic below will detect and build with the available
# features which the host build environment provides. # features which the host build environment provides.
@ -20,46 +21,54 @@
# Internal ROM support can be disabled if GNU make is invoked with # Internal ROM support can be disabled if GNU make is invoked with
# DONT_USE_ROMS=1 on the command line. # DONT_USE_ROMS=1 on the command line.
# #
ifeq ($(WIN32),) # CC Command (and platform available options). (Poor man's autoconf)
#*nix Environments (&& cygwin) #
GCC = gcc ifeq ($(WIN32),) #*nix Environments (&& cygwin)
ifeq ($(GCC),)
GCC = gcc
endif
ifeq (SunOS,$(shell uname)) ifeq (SunOS,$(shell uname))
TEST = /bin/test TEST = /bin/test
else else
TEST = test TEST = test
endif endif
INCPATH=/usr/include ifeq (agcc,$(findstring agcc,$(GCC))) # Android target build?
LIBPATH=/usr/lib OS_CCDEFS = -D_GNU_SOURCE -DSIM_ASYNCH_IO
OS_CCDEFS = -D_GNU_SOURCE OS_LDFLAGS = -lm
ifeq (Darwin,$(shell uname)) else # Non-Android Builds
LIBEXT = dylib INCPATH=/usr/include
else LIBPATH=/usr/lib
ifeq (Linux,$(shell uname)) OS_CCDEFS = -D_GNU_SOURCE
LIBEXT = so ifeq (Darwin,$(shell uname))
ifeq (usrlib64,$(shell if $(TEST) -d /usr/lib64; then echo usrlib64; fi)) LIBEXT = dylib
LIBPATH += /usr/lib64
endif
ifeq (lib32,$(shell if $(TEST) -d /usr/lib32; then echo lib32; fi))
LIBPATH += /usr/lib32
endif
else else
ifeq (SunOS,$(shell uname)) ifeq (Linux,$(shell uname))
LIBEXT = so LIBEXT = so
OS_LDFLAGS += -lsocket -lnsl ifeq (usrlib64,$(shell if $(TEST) -d /usr/lib64; then echo usrlib64; fi))
ifeq (incsfw,$(shell if $(TEST) -d /opt/sfw/include; then echo incsfw; fi)) LIBPATH += /usr/lib64
INCPATH += /opt/sfw/include
OS_CCDEFS += -I/opt/sfw/include
endif endif
ifeq (libsfw,$(shell if $(TEST) -d /opt/sfw/lib; then echo libsfw; fi)) ifeq (lib32,$(shell if $(TEST) -d /usr/lib32; then echo lib32; fi))
LIBPATH += /opt/sfw/lib LIBPATH += /usr/lib32
OS_LDFLAGS += -L/opt/sfw/lib -R/opt/sfw/lib
endif endif
else else
ifeq (usrpkglib,$(shell if $(TEST) -d /usr/pkg/lib; then echo usrpkglib; fi)) ifeq (SunOS,$(shell uname))
LIBPATH += /usr/pkg/lib LIBEXT = so
OS_LDFLAGS += -L/usr/pkg/lib -R/usr/pkg/lib OS_LDFLAGS += -lsocket -lnsl
ifeq (incsfw,$(shell if $(TEST) -d /opt/sfw/include; then echo incsfw; fi))
INCPATH += /opt/sfw/include
OS_CCDEFS += -I/opt/sfw/include
endif
ifeq (libsfw,$(shell if $(TEST) -d /opt/sfw/lib; then echo libsfw; fi))
LIBPATH += /opt/sfw/lib
OS_LDFLAGS += -L/opt/sfw/lib -R/opt/sfw/lib
endif
else
ifeq (usrpkglib,$(shell if $(TEST) -d /usr/pkg/lib; then echo usrpkglib; fi))
LIBPATH += /usr/pkg/lib
OS_LDFLAGS += -L/usr/pkg/lib -R/usr/pkg/lib
endif
LIBEXT = a
endif endif
LIBEXT = a
endif endif
endif endif
endif endif
@ -441,7 +450,11 @@ endif
${BIN}BuildROMs${EXE} : ${BIN}BuildROMs${EXE} :
${MKDIRBIN} ${MKDIRBIN}
ifeq (agcc,$(findstring agcc,$(firstword $(CC))))
gcc $(wordlist 2,1000,${CC}) sim_BuildROMs.c -o $@
else
${CC} sim_BuildROMs.c -o $@ ${CC} sim_BuildROMs.c -o $@
endif
ifeq ($(WIN32),) ifeq ($(WIN32),)
$@ $@
${RM} $@ ${RM} $@