Skip to content

Instantly share code, notes, and snippets.

@AviKav
Last active May 23, 2018 03:00
Show Gist options
  • Save AviKav/cb09e4edc229d15c2237edd9e620672b to your computer and use it in GitHub Desktop.
Save AviKav/cb09e4edc229d15c2237edd9e620672b to your computer and use it in GitHub Desktop.
#To compile with optimisations, pass RELEASE=1 when calling make
ALLEGRO_MODULES = allegro-5 allegro_audio-5 allegro_acodec-5 allegro_dialog-5 allegro_font-5 allegro_image-5 allegro_primitives-5
CFLAGS = $$(pkg-config --cflags $(ALLEGRO_MODULES)) -Wall
LIBS = -lm $$(pkg-config --libs $(ALLEGRO_MODULES))
HEADERS = $(shell find src/ -name '*.h')
OBJECTS = $(shell find src/ -name '*.c' | sed -e 's/\.c$$/.o/g')
.PHONY: all clean
RELEASE ?= 1
ifeq ($(RELEASE), 1)
CFLAGS += -O3
endif
all: bin/lc
clean:
rm -f bin/lc src/*.o
bin/lc: $(OBJECTS)
gcc $(CFLAGS) -o $@ $? $(LIBS)
%.o: %.c $(HEADERS)
gcc $(CFLAGS) -c -o $@ $<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment