Login

Subversion Repositories NedoOS

Rev

Rev 539 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

# Makefile for MinGW by mborik & z00m
# Change `PREFIX` according your needs
# Run it with `make -f Makefile.win`

GCC=gcc.exe
CC=$(GCC)
GPP=g++.exe
C++=$(GPP)

PREFIX=c:/mingw/usr/local/bin/
CREATEDIR=mkdir -p
INSTALL=cp
UNINSTALL=rm -f
WINDRES=windres.exe --preprocessor "cpp.exe"
COMPRESS=upx.exe --best -vk --overlay=skip --compress-icons=0 

EXE=sjasmplus.exe

SUBDIR_BASE=sjasm
SUBDIR_LUA=lua5.4
SUBDIR_LUABRIDGE=LuaBridge/Source
SUBDIR_CRC32C=crc32c

# Ped7g: -pedantic removed due to Lua5.4 having too many warnings
CFLAGS=-DNDEBUG -O2 -Wall -static -DUSE_LUA -DMAX_PATH=PATH_MAX -I$(SUBDIR_LUA) -I$(SUBDIR_LUABRIDGE) -I$(SUBDIR_CRC32C)
CXXFLAGS=-std=gnu++14 $(CFLAGS)

LDFLAGS= -s

#sjasmplus object files
OBJS=\
        $(SUBDIR_BASE)/devices.o \
        $(SUBDIR_BASE)/directives.o \
        $(SUBDIR_BASE)/io_cpc.o \
        $(SUBDIR_BASE)/io_err.o \
        $(SUBDIR_BASE)/io_nex.o \
        $(SUBDIR_BASE)/io_snapshots.o \
        $(SUBDIR_BASE)/io_trd.o \
        $(SUBDIR_BASE)/io_tzx.o \
        $(SUBDIR_BASE)/io_tape.o \
        $(SUBDIR_BASE)/lua_sjasm.o \
        $(SUBDIR_BASE)/parser.o \
        $(SUBDIR_BASE)/reader.o \
        $(SUBDIR_BASE)/relocate.o \
        $(SUBDIR_BASE)/sjasm.o \
        $(SUBDIR_BASE)/sjio.o \
        $(SUBDIR_BASE)/support.o \
        $(SUBDIR_BASE)/tables.o \
        $(SUBDIR_BASE)/z80.o \
        $(SUBDIR_CRC32C)/crc32c.o

#liblua objects
LUAOBJS= \
        $(SUBDIR_LUA)/lcorolib.o $(SUBDIR_LUA)/lctype.o $(SUBDIR_LUA)/lutf8lib.o \
        $(SUBDIR_LUA)/lapi.o $(SUBDIR_LUA)/lauxlib.o $(SUBDIR_LUA)/lbaselib.o \
        $(SUBDIR_LUA)/lcode.o $(SUBDIR_LUA)/ldblib.o $(SUBDIR_LUA)/ldebug.o \
        $(SUBDIR_LUA)/ldo.o $(SUBDIR_LUA)/ldump.o $(SUBDIR_LUA)/lfunc.o \
        $(SUBDIR_LUA)/lgc.o $(SUBDIR_LUA)/linit.o $(SUBDIR_LUA)/liolib.o \
        $(SUBDIR_LUA)/llex.o $(SUBDIR_LUA)/lmathlib.o $(SUBDIR_LUA)/lmem.o \
        $(SUBDIR_LUA)/loadlib.o $(SUBDIR_LUA)/lobject.o $(SUBDIR_LUA)/lopcodes.o \
        $(SUBDIR_LUA)/loslib.o $(SUBDIR_LUA)/lparser.o $(SUBDIR_LUA)/lstate.o \
        $(SUBDIR_LUA)/lstring.o $(SUBDIR_LUA)/lstrlib.o $(SUBDIR_LUA)/ltable.o \
        $(SUBDIR_LUA)/ltablib.o $(SUBDIR_LUA)/ltm.o $(SUBDIR_LUA)/lundump.o \
        $(SUBDIR_LUA)/lvm.o $(SUBDIR_LUA)/lzio.o

RES=sjasmwin32/sjasmplus.res


.PHONY: all clean

all: $(LUAOBJS) $(OBJS) $(RES)
        $(GPP) -o $(EXE) $(CXXFLAGS) $(OBJS) $(LUAOBJS) $(LDFLAGS) $(RES)

install:
        $(CREATEDIR) $(PREFIX)
        $(INSTALL) $(EXE) $(PREFIX)

uninstall:
        $(UNINSTALL) $(PREFIX)/$(EXE)
        
compress:
        $(COMPRESS) $(EXE)      

.c.o:
        $(GCC) $(CFLAGS) -o $@ -c $<

.cpp.o:
        $(GPP) $(CXXFLAGS) -o $@ -c $<

$(RES): sjasmwin32/sjasmplus.mingw.rc
        $(WINDRES) -i $< -O coff -o $@

clean:
        $(UNINSTALL) \
                $(SUBDIR_BASE)/*.o \
                $(SUBDIR_LUA)/*.o \
                $(SUBDIR_CRC32C)/*.o \
                $(RES) $(EXE) *~