Skip to content

Instantly share code, notes, and snippets.

@slauwers
Created March 10, 2015 13:56
Show Gist options
  • Save slauwers/31f7d9b28402d767f4a3 to your computer and use it in GitHub Desktop.
Save slauwers/31f7d9b28402d767f4a3 to your computer and use it in GitHub Desktop.
TARGET := solver
LIBS := -lzmq -ljson-c -lpthread -lcrypto
CC := gcc
CFLAGS := -m64 -std=gnu11 -pedantic -Wall -Wshadow -Wpointer-arith \
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Werror \
-Wextra -O3 -g -Isrc
LFLAGS := -Wall
GRIND := valgrind
GRIND_OPTS := --leak-check=full
SRC_DIR := src
TEST_DIR := tests
TESTS := test_is_anagram
.PHONY: default all clean grind run tests
all: $(TARGET)
OBJECTS := $(SRC_DIR)/client.o $(SRC_DIR)/list.o $(SRC_DIR)/log.o \
$(SRC_DIR)/solver.o
MAIN_OBJECTS := $(SRC_DIR)/main.o
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS) $(MAIN_OBJECTS)
$(CC) $^ $(LFLAGS) $(LIBS) -o $@
clean:
-rm -f $(SRC_DIR)/*.o $(TEST_DIR)/*.o
-rm -f $(TARGET)
grind: all
$(GRIND) $(GRIND_OPTS) ./$(TARGET)
run: all
./$(TARGET)
tests: $(TESTS)
test_is_anagram: $(OBJECTS) $(TEST_DIR)/test_is_anagram.o
$(CC) $^ $(CFLAGS) -Wall $(LIBS) -o $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment