ffelnxsdl.mak 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Suffices used in implicit rules
  2. .SUFFIXES: .asm .cpp .c .d
  3. OBJDIR = linux/
  4. OUTFILE = ffelnxsdl
  5. CONVFILE = $(OBJDIR)lnxconv
  6. # Search paths for source files
  7. NONSYSDIRS =
  8. SYSDIRS = linux sdl
  9. # Source files
  10. NONSYSFILES = ffelnx.asm ffebmp.asm ffemisc.c ffecfg.c
  11. SYSFILES = sdlvideo.cpp sdlsound.cpp sdlinput.cpp sdltimer.cpp linuxdir.c
  12. # Modify this for different systems
  13. SRCDIRS = $(NONSYSDIRS) $(SYSDIRS)
  14. SRCFILES = $(NONSYSFILES) $(SYSFILES)
  15. SYSFLAGS = -I.
  16. vpath %.asm $(SRCDIRS)
  17. vpath %.c $(SRCDIRS)
  18. vpath %.cpp $(SRCDIRS)
  19. ASMFILES = $(filter %.asm,$(SRCFILES))
  20. CFILES = $(filter %.c,$(SRCFILES))
  21. CPPFILES = $(filter %.cpp,$(SRCFILES))
  22. OBJFILES = $(ASMFILES:%.asm=$(OBJDIR)%.o) $(CFILES:%.c=$(OBJDIR)%.o)\
  23. $(CPPFILES:%.cpp=$(OBJDIR)%.o)
  24. DEPFILES = $(CFILES:%.c=$(OBJDIR)%.d)
  25. # Flags variables
  26. override CFLAGS += $(SYSFLAGS) -Wall -D__FFELNXSDL__
  27. LINKFLAG = -Wl,-Map,map.log
  28. NASMFLAGS = -f elf -i.
  29. CC = gcc
  30. CXX = g++
  31. XTRALIBS = -lstdc++ $(shell sdl-config --libs) -lGL
  32. override CFLAGS += $(shell sdl-config --cflags)
  33. # Targets
  34. all: $(OUTFILE)
  35. debug:
  36. $(MAKE) CFLAGS=-g
  37. profile:
  38. $(MAKE) CFLAGS=-pg
  39. opt:
  40. $(MAKE) CFLAGS=-O3
  41. clean:
  42. rm -f $(OBJDIR)*.o
  43. rm -f $(OBJDIR)ffelnx.asm
  44. rm -f $(OUTFILE)
  45. rm -f $(CONVFILE)
  46. # Nasty ffelnx.asm creation
  47. $(OBJDIR)ffelnx.asm: ffe.asm $(CONVFILE)
  48. $(CONVFILE) ffe.asm $@
  49. $(OBJDIR)ffelnx.o : $(OBJDIR)ffelnx.asm
  50. nasm $(NASMFLAGS) -o $@ $<
  51. $(CONVFILE): lnxconv.c
  52. $(CC) $(CFLAGS) $(LINKFLAG) -o $@ $^
  53. # Implicit rules
  54. $(OBJDIR)%.o : %.c
  55. $(CC) $(CFLAGS) -c -o $@ $<
  56. $(OBJDIR)%.o : %.cpp
  57. $(CXX) $(CFLAGS) -c -o $@ $<
  58. $(OBJDIR)%.o : %.asm
  59. nasm $(NASMFLAGS) -o $@ $<
  60. # Executables
  61. $(OUTFILE): $(OBJFILES)
  62. $(CXX) $(CFLAGS) $(LINKFLAG) -o $@ $^ $(XTRALIBS)