purrforce/Makefile

178 lines
4.9 KiB
Makefile
Raw Normal View History

2024-03-20 00:48:21 +00:00
# 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 # \
2024-03-26 01:23:54 +00:00
CCOBJ=cl /nologo /c /Iinclude # \
2024-03-20 00:48:21 +00:00
OBJOUT=/Fo#\
EXEOUT=/Fe#\
2024-03-26 01:23:54 +00:00
CCEXE=cl /nologo /Iinclude # \
#LDFLAGS=SDL2main.lib SDL2.lib shell32.lib /link /subsystem:windows # \
LDFLAGS= kernel32.lib user32.lib shell32.lib /link /subsystem:console # \
RUNPREFIX= # \
USE_TRAY=-DTRAY_WINAPI=1 # \
LINK_TRAY= # \
LINK_SDL= SDL2.lib #\
2024-03-20 00:48:21 +00:00
!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=
2024-03-26 01:23:54 +00:00
RUNPREFIX=./
USE_TRAY=-DTRAY_APPINDICATOR=1 $(shell pkg-config --cflags appindicator3-0.1)
LINK_TRAY=$(shell pkg-config --libs appindicator3-0.1)
LINK_SDL= SDL2.lib
2024-03-20 00:48:21 +00:00
# \
!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
2024-03-26 01:23:54 +00:00
-@$(RM) tray.exe
-@$(RM) icon.ico
-@$(RM) pf.ico
-@$(RM) pf.png
2024-03-20 00:48:21 +00:00
-@$(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 \
2024-03-26 01:23:54 +00:00
build$(PS)error.obj \
build$(PS)stats.obj \
build$(PS)systray.obj
2024-03-20 00:48:21 +00:00
build$(PS)main.obj: build Makefile main.c api.h include$(PS)SDL.h include$(PS)SDL_image.h
$(CCOBJ) main.c $(OBJOUT)$@
2024-03-26 01:23:54 +00:00
build$(PS)stats.obj: build Makefile stats.c api.h include$(PS)SDL.h include$(PS)SDL_image.h
$(CCOBJ) stats.c $(OBJOUT)$@
2024-03-20 00:48:21 +00:00
build$(PS)error.obj: build Makefile api.h error.c
$(CCOBJ) error.c $(OBJOUT)$@
2024-03-26 01:23:54 +00:00
build$(PS)systray.obj: build pf.ico pf.png api.h tray$(PS)tray.h
$(CCOBJ) systray.c $(OBJOUT)$@
2024-03-20 00:48:21 +00:00
build:
mkdir build
2024-03-26 01:23:54 +00:00
pf.ico: images$(PS)pf.ico
$(CP) images$(PS)pf.ico $@
pf.png: images$(PS)pf.png
$(CP) images$(PS)pf.png $@
2024-03-20 00:48:21 +00:00
purforce: purforce.exe
2024-03-26 01:23:54 +00:00
$(RUNPREFIX)purforce.exe
2024-03-20 00:48:21 +00:00
purforce.exe: $(PUR_OBJS) $(SDL2LIB) $(SDL2IMGLIB) Makefile
2024-03-26 01:23:54 +00:00
$(CCEXE) $(PUR_OBJS) $(SDL2IMGLIB) $(EXEOUT)$@ $(LINK_SDL) $(LDFLAGS)
2024-03-20 00:48:21 +00:00
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
2024-03-26 01:23:54 +00:00
touch SDL2.a
build$(PS)trayxmpl.obj: build tray$(PS)example.c tray$(PS)tray.h
$(CCOBJ) $(USE_TRAY) tray$(PS)example.c $(OBJOUT)$@
icon.ico: tray$(PS)icon.ico
$(CP) tray$(PS)icon.ico $@
tray.exe: build$(PS)trayxmpl.obj icon.ico
$(CCEXE) $(USE_TRAY) build$(PS)trayxmpl.obj $(EXEOUT)$@ $(LINK_TRAY) $(LDFLAGS)
tray: tray.exe
$(RUNPREFIX)tray.exe