| @@ -1,4 +1,4 @@ | |||||
| Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | of this software and associated documentation files (the "Software"), to deal | ||||
| @@ -22,8 +22,8 @@ Installing | |||||
| ---------- | ---------- | ||||
| Only OS X and Linux are tested. You'll need a decent compiler that supports C11 | Only OS X and Linux are tested. You'll need a decent compiler that supports C11 | ||||
| (gcc, clang) and SDL 2. Using Homebrew, you can `brew install sdl2`; using apt, | |||||
| you can `apt-get install libsdl2-dev`. | |||||
| (clang preferred) and SDL 2. Using Homebrew, you can `brew install sdl2`; using | |||||
| apt, you can `apt-get install libsdl2-dev`. | |||||
| Run `make` to create `./crater`. To build the development version with debug | Run `make` to create `./crater`. To build the development version with debug | ||||
| symbols (they can exist simultaneously), run `make DEBUG=1`, which creates | symbols (they can exist simultaneously), run `make DEBUG=1`, which creates | ||||
| @@ -1,4 +1,4 @@ | |||||
| /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Released under the terms of the MIT License. See LICENSE for details. */ | Released under the terms of the MIT License. See LICENSE for details. */ | ||||
| #include <dirent.h> | #include <dirent.h> | ||||
| @@ -6,36 +6,37 @@ SOURCES = src | |||||
| BUILD = build | BUILD = build | ||||
| DEVEXT = -dev | DEVEXT = -dev | ||||
| CC = gcc | |||||
| FLAGS = -O2 -Wall -pedantic -std=c11 | |||||
| CC = clang | |||||
| FLAGS = -O2 -Wall -Wextra -pedantic -std=c11 | |||||
| CFLAGS = $(shell sdl2-config --cflags) | CFLAGS = $(shell sdl2-config --cflags) | ||||
| LIBS = $(shell sdl2-config --libs) | LIBS = $(shell sdl2-config --libs) | ||||
| MKDIR = mkdir -p | MKDIR = mkdir -p | ||||
| RM = rm -rf | RM = rm -rf | ||||
| MODE = release | MODE = release | ||||
| BNRY = $(PROGRAM) | |||||
| SRCS = $(foreach d,.,$(wildcard *.c)) $(foreach d,$(SOURCES),$(wildcard $(addprefix $(d)/*,.c))) | SRCS = $(foreach d,.,$(wildcard *.c)) $(foreach d,$(SOURCES),$(wildcard $(addprefix $(d)/*,.c))) | ||||
| OBJS = $(patsubst %.c,%.o,$(addprefix $(BUILD)/$(MODE)/,$(SRCS))) | OBJS = $(patsubst %.c,%.o,$(addprefix $(BUILD)/$(MODE)/,$(SRCS))) | ||||
| DEPS = $(OBJS:%.o=%.d) | DEPS = $(OBJS:%.o=%.d) | ||||
| DIRS = $(sort $(dir $(OBJS))) | DIRS = $(sort $(dir $(OBJS))) | ||||
| ifdef DEBUG | ifdef DEBUG | ||||
| PROGRAM := $(PROGRAM)$(DEVEXT) | |||||
| FLAGS += -g | |||||
| MODE = debug | |||||
| BNRY := $(BNRY)$(DEVEXT) | |||||
| FLAGS += -g -DDEBUG_MODE | |||||
| MODE = debug | |||||
| endif | endif | ||||
| .PHONY: all clean | .PHONY: all clean | ||||
| all: $(PROGRAM) | |||||
| all: $(BNRY) | |||||
| clean: | clean: | ||||
| $(RM) $(PROGRAM) $(PROGRAM)$(DEVEXT) $(BUILD) | |||||
| $(RM) $(BUILD) $(PROGRAM) $(PROGRAM)$(DEVEXT) | |||||
| $(DIRS): | $(DIRS): | ||||
| $(MKDIR) $@ | $(MKDIR) $@ | ||||
| $(PROGRAM): $(OBJS) | |||||
| $(BNRY): $(OBJS) | |||||
| $(CC) $(FLAGS) $(LIBS) $(OBJS) -o $@ | $(CC) $(FLAGS) $(LIBS) $(OBJS) -o $@ | ||||
| $(OBJS): | $(DIRS) | $(OBJS): | $(DIRS) | ||||
| @@ -1,4 +1,4 @@ | |||||
| /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Released under the terms of the MIT License. See LICENSE for details. */ | Released under the terms of the MIT License. See LICENSE for details. */ | ||||
| #pragma once | #pragma once | ||||
| @@ -1,4 +1,4 @@ | |||||
| /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Released under the terms of the MIT License. See LICENSE for details. */ | Released under the terms of the MIT License. See LICENSE for details. */ | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| @@ -1,4 +1,4 @@ | |||||
| /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Released under the terms of the MIT License. See LICENSE for details. */ | Released under the terms of the MIT License. See LICENSE for details. */ | ||||
| #pragma once | #pragma once | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Released under the terms of the MIT License. See LICENSE for details. */ | Released under the terms of the MIT License. See LICENSE for details. */ | ||||
| #pragma once | #pragma once | ||||
| #define CRATER_VERSION "0.1.dev" | |||||
| #define CRATER_VERSION "0.1.0-dev" | |||||
| @@ -1,4 +1,4 @@ | |||||
| /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Released under the terms of the MIT License. See LICENSE for details. */ | Released under the terms of the MIT License. See LICENSE for details. */ | ||||
| #include "z80.h" | #include "z80.h" | ||||
| @@ -1,4 +1,4 @@ | |||||
| /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com> | |||||
| Released under the terms of the MIT License. See LICENSE for details. */ | Released under the terms of the MIT License. See LICENSE for details. */ | ||||
| #pragma once | #pragma once | ||||