-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (49 loc) · 1.1 KB
/
Makefile
File metadata and controls
62 lines (49 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
export PGDATABASE:=flight
export PGUSER :=postgres
export PGPASSWORD :=1234
export PGCLIENTENCODING:=UTF8
export PGHOST:=localhost
DBNAME =$(PGDATABASE)
PSQL = psql
CREATEDB = createdb
DROPDB = dropdb --if-exists
PG_DUMP = pg_dump
PG_RESTORE = pg_restore
CC = gcc -g
CFLAGS = -Wall -Wextra -pedantic -ansi
LDLIBS = -lodbc -lcurses -lpanel -lmenu -lform
# recompile if this header changes
HEADERS = odbc.h bpass.h lmenu.h search.h windows.h loop.h
EXE = menu dropdb createdb restore shell
OBJ = menu.o bpass.o loop.o search.o windows.o odbc.o
all : $(EXE)
createdb:
@echo Creando BBDD
@$(CREATEDB)
dropdb:
@echo Eliminando BBDD
@$(DROPDB) $(DBNAME)
rm -f *.log
dump:
@echo creando dumpfile
@$(PG_DUMP) > $(DBNAME).sql
restore:
@echo restore data base
@cat $(DBNAME).sql | $(PSQL)
psql: shell
shell:
@echo create psql shell
@$(PSQL)
# compile all files ending in *.c
%.o: %.c $(HEADERS)
@echo Compiling $<...
$(CC) $(CFLAGS) -c -o $@ $<
# link binary
menu: $(DEPS) $(OBJ)
$(CC) -o menu $(OBJ) $(LDLIBS)
clean:
rm -f *.o core $(EXE)
run:
./$(EXE)
valgrind:
valgrind --leak-check=full ./$(EXE)