Fix osx target -> machos

This commit is contained in:
Max 2018-12-21 03:30:13 +00:00
parent d844c9dd1f
commit e49ff6d2d0
1 changed files with 58 additions and 58 deletions

View File

@ -1,58 +1,58 @@
#compiler flags: -Wall Warnings all, -g gdb debug markings, #compiler flags: -Wall Warnings all, -g gdb debug markings,
CFLAGS=-Wall -O CFLAGS=-Wall -O
LDFLAGS= -llua -lusb-1.0 -Lsource/lua LDFLAGS= -llua -lusb-1.0 -Lsource/lua
INCLUDE= -I ./include -I ../shared INCLUDE= -I ./include -I ../shared
LDFLAGS_WINDOWS= -L ./winlib $(LDFLAGS) LDFLAGS_WINDOWS= -L ./winlib $(LDFLAGS)
LDFLAGS_UNIX= -lm $(LDFLAGS) LDFLAGS_UNIX= -lm $(LDFLAGS)
CC= gcc CC= gcc
SOURCES=$(wildcard source/*.c) SOURCES=$(wildcard source/*.c)
OBJECTS=$(SOURCES:.c=.o) OBJECTS=$(SOURCES:.c=.o)
# Use GCC preprocessor to determine dependencies for all source files. # Use GCC preprocessor to determine dependencies for all source files.
DEPS=$(OBJECTS:.o=.d) DEPS=$(OBJECTS:.o=.d)
%.d: %.c %.d: %.c
@$(CC) $(CFLAGS) $(INCLUDE) $< -MM -MT $(@:.d=.o) >$@ @$(CC) $(CFLAGS) $(INCLUDE) $< -MM -MT $(@:.d=.o) >$@
# Include generated .d Makefile fragments to manage object dependencies. # Include generated .d Makefile fragments to manage object dependencies.
-include $(DEPS) -include $(DEPS)
# Provide recipes for building all objects, dependencies managed via earlier inclusion. # Provide recipes for building all objects, dependencies managed via earlier inclusion.
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
.PHONY: clean linux osx .PHONY: clean linux macosx
# TODO: Pass through platform when building liblua. # TODO: Pass through platform when building liblua.
liblua: liblua:
$(MAKE) -C source/lua a $(MAKE) -C source/lua a
TARGET=inlretro TARGET=inlretro
#default to windows build #default to windows build
all: liblua $(DEPS) $(OBJECTS) all: liblua $(DEPS) $(OBJECTS)
$(CC) $(INCLUDE) $(OBJECTS) -o $(TARGET) $(CFLAGS) $(LDFLAGS_WINDOWS) $(CC) $(INCLUDE) $(OBJECTS) -o $(TARGET) $(CFLAGS) $(LDFLAGS_WINDOWS)
#unix build doesn't need winlib directory as libusb should be installed on OS. #unix build doesn't need winlib directory as libusb should be installed on OS.
#sudo apt-get install libusb-1.0-0-dev #sudo apt-get install libusb-1.0-0-dev
unix: liblua $(DEPS) $(OBJECTS) unix: liblua $(DEPS) $(OBJECTS)
$(CC) $(INCLUDE) $(OBJECTS) -o $(TARGET) $(CFLAGS) $(LDFLAGS_UNIX) $(CC) $(INCLUDE) $(OBJECTS) -o $(TARGET) $(CFLAGS) $(LDFLAGS_UNIX)
# Convienience in case its not clear Unix really means not-Windows. # Convienience in case its not clear Unix really means not-Windows.
linux: unix linux: unix
macosx: unix macosx: unix
# "make debug" will build program with debug print messages # "make debug" will build program with debug print messages
# -DDEBUG show debug logs # -DDEBUG show debug logs
# -g build with gdb debug tags # -g build with gdb debug tags
debug: CFLAGS += -DDEBUG -g debug: CFLAGS += -DDEBUG -g
debug: all debug: all
#unix debug build #unix debug build
unixdebug: CFLAGS += -DDEBUG -g unixdebug: CFLAGS += -DDEBUG -g
unixdebug: unix unixdebug: unix
#clean on unix and windows(.exe) #clean on unix and windows(.exe)
clean: clean:
$(MAKE) -C source/lua clean $(MAKE) -C source/lua clean
rm -f $(TARGET) $(TARGET).exe $(OBJECTS) $(DEPS) $(LUAOBJ) source/lua/liblua.a rm -f $(TARGET) $(TARGET).exe $(OBJECTS) $(DEPS) $(LUAOBJ) source/lua/liblua.a