purrforce/Makefile

145 lines
3.8 KiB
Makefile

# NMAKE code here \
!ifndef 0 # \
MV=move /Y # \
RM=del /F/Q # \
RMDIR=rmdir /S/Q # \
CP=copy /B/Y # \
PS=\ # \
CAT=type # \
SEVENZ="C:\Program Files\7-Zip\7z.exe" -y # \
SDL2LIB=SDL2.lib # \
SDL2IMGLIB=SDL2_image.lib # \
CCOBJ=cl /c /Iinclude # \
OBJOUT=/Fo#\
EXEOUT=/Fe#\
CCEXE=cl /Iinclude # \
LDFLAGS=SDL2main.lib SDL2.lib shell32.lib /link /subsystem:windows # \
!else
# Make code here
MV=mv -f
RM=rm -f
CP=cp -f
CAT=cat
PS=/
SEVENZ=7z -y
RMDIR=rm -f
SDL2LIB=SDL2.a
SDL2IMGLIB=SDL2_image.so
CCOBJ=gcc -c -Iinclude
OBJOUT=-o
EXEOUT=-o
CCEXE=gcc -Iinclude
LDFLAGS=
# \
!endif
check:
@echo MV=$(MV)
@echo RM=$(RM)
@echo CP=$(CP)
@echo CAT=$(CAT)
@echo PS=$(PS)
@echo RMDIR=$(RMDIR)
@echo SEVENZ=$(SEVENZ)
@echo SDL2LIB=$(SDL2LIB)
@echo LDFLAGS=$(LDFLAGS)
@echo if this is correct, run "make purforce"
@echo other options:
@echo all, purforce, clean, reallyclean, distclean
all: purforce
clean:
-@$(RM) build$(PS)*.obj
-@$(RM) sdl2dev.zip
-@$(RM) sdl2imgdev.zip
-@$(RM) SDL2-2.30.0$(PS)*.txt
-@$(RM) SDL2-2.30.0$(PS)docs$(PS)*.md
-@$(RM) SDL2-2.30.0$(PS)docs$(PS)doxyfile
-@$(RMDIR) SDL2-2.30.0$(PS)docs
-@$(RM) SDL2-2.30.0$(PS)cmake$(PS)*.cmake
-@$(RMDIR) SDL2-2.30.0$(PS)cmake
-@$(RM) SDL2-2.30.0$(PS)include$(PS)*.h
-@$(RMDIR) SDL2-2.30.0$(PS)include
-@$(RM) SDL2-2.30.0$(PS)lib$(PS)x64$(PS)*.lib
-@$(RM) SDL2-2.30.0$(PS)lib$(PS)x64$(PS)*.dll
-@$(RMDIR) SDL2-2.30.0$(PS)lib$(PS)x64
-@$(RM) SDL2-2.30.0$(PS)lib$(PS)x86$(PS)*.lib
-@$(RM) SDL2-2.30.0$(PS)lib$(PS)x86$(PS)*.dll
-@$(RMDIR) SDL2-2.30.0$(PS)lib$(PS)x86
-@$(RMDIR) SDL2-2.30.0$(PS)lib
-@$(RMDIR) SDL2-2.30.0
-@$(RM) SDL2_image-2.8.2$(PS)*.txt
-@$(RM) SDL2_image-2.8.2$(PS)cmake$(PS)*.cmake
-@$(RMDIR) SDL2_image-2.8.2$(PS)cmake
-@$(RM) SDL2_image-2.8.2$(PS)lib$(PS)x64$(PS)*.dll
-@$(RM) SDL2_image-2.8.2$(PS)lib$(PS)x64$(PS)*.lib
-@$(RM) SDL2_image-2.8.2$(PS)lib$(PS)x86$(PS)*.dll
-@$(RM) SDL2_image-2.8.2$(PS)lib$(PS)x86$(PS)*.lib
-@$(RMDIR) SDL2_image-2.8.2$(PS)lib$(PS)x64
-@$(RMDIR) SDL2_image-2.8.2$(PS)lib$(PS)x86
-@$(RMDIR) SDL2_image-2.8.2$(PS)lib
-@$(RM) SDL2_image-2.8.2$(PS)include$(PS)*.h
-@$(RMDIR) SDL2_image-2.8.2$(PS)include
-@$(RMDIR) SDL2_image-2.8.2
veryclean:reallyclean
reallyclean: clean
-@$(RM) purforce.exe
-@$(RMDIR) build
distclean: reallyclean
-@$(RM) SDL2.a
-@$(RM) SDL2.lib
-@$(RM) SDL2.dll
-@$(RM) SDL2_image.lib
-@$(RM) SDL2_image.dll
-@$(RM) SDL2main.lib
-@$(RM) include$(PS)*.h
-@$(RMDIR) include
PUR_OBJS= \
build$(PS)main.obj \
build$(PS)error.obj
build$(PS)main.obj: build Makefile main.c api.h include$(PS)SDL.h include$(PS)SDL_image.h
$(CCOBJ) main.c $(OBJOUT)$@
build$(PS)error.obj: build Makefile api.h error.c
$(CCOBJ) error.c $(OBJOUT)$@
build:
mkdir build
purforce: purforce.exe
purforce.exe: $(PUR_OBJS) $(SDL2LIB) $(SDL2IMGLIB) Makefile
$(CCEXE) $(PUR_OBJS) $(SDL2IMGLIB) $(EXEOUT)$@ $(LDFLAGS)
sdl2dev.zip:
$(CP) ..\..\assets\windows\SDL2-devel-2.30.0-VC.zip $@
sdl2imgdev.zip:
$(CP) ..\..\assets\windows\SDL2_image-devel-2.8.2-VC.zip $@
include:
mkdir include
include$(PS)SDL.h: sdl2dev.zip include
$(SEVENZ) x sdl2dev.zip
$(CP) SDL2-2.30.0$(PS)include$(PS)*.h include$(PS)
touch include$(PS)SDL.h
include$(PS)SDL_image.h: sdl2imgdev.zip include
$(SEVENZ) x sdl2imgdev.zip
$(CP) SDL2_image-2.8.2$(PS)include$(PS)*.h include$(PS)
touch include$(PS)SDL_image.h
SDL2_image.lib: sdl2imgdev.zip
$(SEVENZ) x sdl2imgdev.zip
$(CP) SDL2_image-2.8.2\lib\x64\SDL2_image.dll SDL2_image.dll
$(CP) SDL2_image-2.8.2\lib\x64\SDL2_image.lib SDL2_image.lib
touch SDL2_image.lib
SDL2.lib: sdl2dev.zip
$(SEVENZ) x sdl2dev.zip
$(CP) SDL2-2.30.0\lib\x64\SDL2.dll SDL2.dll
$(CP) SDL2-2.30.0\lib\x64\SDL2.lib SDL2.lib
$(CP) SDL2-2.30.0\lib\x64\SDL2main.lib SDL2main.lib
touch SDL2.lib
SDL2.a:
sudo apt-get install sdl2-dev
ln -s /user/local/lib/sdl2/sdl2.so ./SDL2.a
touch SDL2.a