Makefile (1132B)
1# ***************************************************** 2# Variables to control Makefile operation 3 4# Might want when doing linux -> win cross build 5# LFLAGS = -s -static 6 7CXX = $(TOOLSPREFIX)g++ 8CXXFLAGS = -Os -Wall -g 9LFLAGS = -g 10 11ifeq ($(OS),Windows_NT) 12 BUILD_OS := Windows_NT 13else 14 BUILD_OS := $(shell uname -s) 15endif 16 17# Target older macOS version than whatever build OS is for better compatibility 18ifeq ($(BUILD_OS),Darwin) 19 export MACOSX_DEPLOYMENT_TARGET=10.10 20endif 21 22 23# Static flag for windows cross and native builds 24ifeq ($(TOOLSPREFIX),i686-w64-mingw32-) 25# prefix will automatically be .exe for cross build 26 EXT = .exe 27 LFLAGS += -static 28endif 29 30ifeq ($(OS),Windows_NT) 31 EXT = .exe 32 LFLAGS += -static 33endif 34 35 36 37 38# **************************************************** 39# Targets needed to bring the executable up to date 40 41TARGET = png2asset 42 43 44SRCS := lodepng.cpp png2asset.cpp 45OBJS := $(SRCS:%.cpp=%.o) 46 47$(TARGET): $(OBJS) 48 $(CXX) $(LFLAGS) -o $(TARGET) $(OBJS) 49 strip $@$(EXT) 50 51# The main.o target can be written more simply 52 53%.cpp.o: %.cpp 54 $(CXX) $(CXXFLAGS) -c $< -o $@ 55 56clean: 57 rm -f *.o 58 rm -f *.exe 59 rm -f TARGET 60