Skip to content

Instantly share code, notes, and snippets.

@SaitoAtsushi
Created January 18, 2018 22:46
Show Gist options
  • Save SaitoAtsushi/d230b0ecd026427922694077a4cba626 to your computer and use it in GitHub Desktop.
Save SaitoAtsushi/d230b0ecd026427922694077a4cba626 to your computer and use it in GitHub Desktop.
ISLISP 処理系 KISS 用の makefile
SRCS := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(SRCS))
DOBJS := $(addprefix debug/,$(OBJS))
POBJS := $(addprefix profile/,$(OBJS))
CC = gcc
CFLAGS = -Wall -O3
LDFLAGS =
LIBS = -lm -lgmp
UNAME = $(shell uname -a)
ifneq (,$(findstring MINGW, $(UNAME)))
EXT = .exe
else
EXT =
endif
TARGET = kiss$(EXT)
.PHONY: all clean test
all: $(TARGET)
debug: debug_dir debug/$(TARGET)
debug_dir:
-mkdir debug
profile: profile_dir profile/$(TARGET)
profile_dir:
-mkdir profile
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
debug/$(TARGET): $(DOBJS)
$(CC) $(LDFLAGS) -g -o $@ $^ $(LIBS)
profile/$(TARGET): $(POBJS)
$(CC) $(LDFLAGS) -pg -o $@ $^ $(LIBS)
./%.o: %.c kiss.h
$(CC) -c $(CFLAGS) $< -o $@
debug/%.o: %.c kiss.h
$(CC) -c $(CFLAGS) -g $< -o $@
profile/%.o: %.c kiss.h
$(CC) -c $(CFLAGS) -pg $< -o $@
clean:
rm -f $(TARGET) $(OBJS) $(DOBJS) $(POBJS) newfile example.dat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment