Commit 727cab98 authored by nagayama15's avatar nagayama15

exampleのディレクトリ構造を変更

parent d661b54b
SRCS := \
fizzbuzz.c
LLS := ${SRCS:.c=.ll}
LLS_0 := ${SRCS:%.c=%-0.ll}
LLS_1 := ${SRCS:%.c=%-1.ll}
LLS_2 := ${SRCS:%.c=%-2.ll}
BINS := ${LLS:.ll=} ${LLS_0:.ll=} ${LLS_1:.ll=} ${LLS_2:.ll=}
.PHONY: all test clean .PHONY: all test clean
all: ${BINS} all:
${MAKE} -C fizzbuzz
test: ${BINS}
./fizzbuzz > fizzbuzz.txt
./fizzbuzz-0 > fizzbuzz-0.txt
./fizzbuzz-1 > fizzbuzz-1.txt
./fizzbuzz-2 > fizzbuzz-2.txt
${BINS}: ${LLS} ${LLS_0} ${LLS_1} ${LLS_2}
%.ll: %.c
clang -emit-llvm -S -O2 -o $@ $<
%-0.ll: %.ll
opt-6.0 -load ../nykk.so -block-wm -watermark=0 -S -o $@ $<
%-1.ll: %.ll
opt-6.0 -load ../nykk.so -block-wm -watermark=1 -S -o $@ $<
%-2.ll: %.ll
opt-6.0 -load ../nykk.so -block-wm -watermark=2 -S -o $@ $<
%: %.ll test:
clang -o $@ $< ${MAKE} -C fizzbuzz test
clean: clean:
${RM} ${BINS} *.ll *.txt ${MAKE} -C fizzbuzz clean
#include <stdio.h>
int main(void)
{
for (int i = 1; i <= 50; i++)
{
if (i % (3 * 5) == 0)
{
printf("Fizz Buzz\n");
}
else if (i % 3 == 0)
{
printf("Fizz\n");
}
else if (i % 5 == 0)
{
printf("Buzz\n");
}
else
{
printf("%d\n", i);
}
}
}
SRCS := \
fizzbuzz.c
LLS := ${SRCS:.c=.ll}
LLS_0 := ${SRCS:%.c=%-0.ll}
LLS_1 := ${SRCS:%.c=%-1.ll}
LLS_2 := ${SRCS:%.c=%-2.ll}
BINS := ${LLS:.ll=} ${LLS_0:.ll=} ${LLS_1:.ll=} ${LLS_2:.ll=}
.PHONY: all test clean
all: ${BINS}
test: ${BINS}
./fizzbuzz > fizzbuzz.txt
./fizzbuzz-0 > fizzbuzz-0.txt
./fizzbuzz-1 > fizzbuzz-1.txt
./fizzbuzz-2 > fizzbuzz-2.txt
${BINS}: ${LLS} ${LLS_0} ${LLS_1} ${LLS_2}
%.ll: %.c
clang -emit-llvm -S -O2 -o $@ $<
%-0.ll: %.ll
opt-6.0 -load ../../nykk.so -block-wm -watermark=0 -S -o $@ $<
%-1.ll: %.ll
opt-6.0 -load ../../nykk.so -block-wm -watermark=1 -S -o $@ $<
%-2.ll: %.ll
opt-6.0 -load ../../nykk.so -block-wm -watermark=2 -S -o $@ $<
%: %.ll
clang -o $@ $<
clean:
${RM} ${BINS} *.ll *.txt
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment