Skip to content

Commit 4435481

Browse files
author
Vladimir Kotal
committed
add basic makefile infrastructure
1 parent 542a254 commit 4435481

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

Makefile

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
all: cstyle
1+
MAKE=make
22

3-
.PHONY: cstyle
3+
SUBDIRS=assert \
4+
debug
5+
6+
all: $(SUBDIRS) cstyle
7+
8+
$(SUBDIRS):
9+
@$(MAKE) -C $@
10+
11+
clean:
12+
for dir in $(SUBDIRS); do \
13+
$(MAKE) -C $$dir $@; \
14+
done
15+
16+
.PHONY: cstyle all clean $(SUBDIRS)
417
cstyle:
518
@echo "checking C style"
619
@find . -type f -name '*.c' | while read file; do \

Makefile.common

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CC=cc
2+
CFLAGS=-Wall -pedantic
3+
4+
%.o: %.c
5+
$(CC) $(CFLAGS) -c $<

assert/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include ../Makefile.common
2+
3+
all: assert
4+
5+
assert: assert.o
6+
$(CC) -o $@ $<
7+
8+
clean:
9+
rm -f *.o a.out assert

debug/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include ../Makefile.common
2+
3+
all: coredump
4+
5+
assert: coredump.o
6+
$(CC) -o $@ $<
7+
8+
clean:
9+
rm -f *.o a.out coredump

0 commit comments

Comments
 (0)