aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 14:44:36 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 14:44:36 +0100
commitec12087e594b563fdff079be5fa64da8aa27ad57 (patch)
treef19ab48ab5ac12505c4edf9e1a8795826e17d1cb
parentRename hash_help.inc => hash.inc. (diff)
downloadcalp-ec12087e594b563fdff079be5fa64da8aa27ad57.tar.gz
calp-ec12087e594b563fdff079be5fa64da8aa27ad57.tar.xz
Makefile now places .o files in subdir.
-rw-r--r--Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index f5a36c8f..56992ac5 100644
--- a/Makefile
+++ b/Makefile
@@ -3,18 +3,22 @@
CC := gcc
LEX := flex
+DIRS := obj
+
CFLAGS = -Wall -DSAFE_STR -DSAFE_HASH -ggdb
#LFLAGS =
#LDFLAGS =
C_FILES = $(wildcard *.c)
INC_FILES = $(wildcard *.inc)
-O_FILES = $(C_FILES:.c=.o)
+O_FILES = $(addprefix obj/,$(C_FILES:.c=.o))
H_FILES = $(wildcard *.h)
+$(shell mkdir -p $(DIRS))
+
all: parse
-%.o : %.c $(H_FILES) $(INC_FILES)
+obj/%.o : %.c $(H_FILES) $(INC_FILES)
$(CC) -c -o $@ $< ${CFLAGS}
parse: $(O_FILES)
@@ -22,4 +26,4 @@ parse: $(O_FILES)
clean:
-rm parse
- -rm *.o
+ -rm obj/*.o