-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (46 loc) · 1.64 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
#Compiler and Linker
CC = gcc
#The Target Binary Program
TARGET := cgp_mig
#The Directories, Source, Includes, Objects, Binary and Resources
SRCDIR := src
LIBDIR := lib
BUILDDIR := obj
TARGETDIR := bin
#Flags, Libraries and Includes
CFLAGS := -std=c11 -pedantic -Wno-pedantic-ms-format -Wno-unused-function -Wall -O3 -fopenmp -D NO_DLL
CGP_LIB := $(LIBDIR)/cgp_lib
CGP_DATA := cgp_data_creation
COMB_CIRC := combination_circuits
##########################################################################
all: clean linking subdirs
linking: $(TARGETDIR)/$(TARGET).exe
run: linking
@./$(TARGETDIR)/$(TARGET).exe
dataset: $(TARGETDIR)/$(CGP_DATA).exe
@./$<
$(TARGETDIR)/$(TARGET).exe: $(BUILDDIR)/$(TARGET).o $(BUILDDIR)/cgp_lib.o
$(CC) $(CFLAGS) $^ -o $@
$(TARGETDIR)/$(CGP_DATA).exe: $(BUILDDIR)/$(CGP_DATA).o $(BUILDDIR)/cgp_lib.o $(BUILDDIR)/$(COMB_CIRC).o
$(CC) $(CFLAGS) $^ -o $@
##########################################################################
# Object files
#CGP_MIG
$(BUILDDIR)/$(TARGET).o: $(SRCDIR)/$(TARGET).c $(SRCDIR)/$(TARGET).h
$(CC) $(CFLAGS) -c $< -o $@
#CGP_LIB
$(BUILDDIR)/cgp_lib.o: $(CGP_LIB)/cgp.c $(CGP_LIB)/cgp.h
$(CC) $(CFLAGS) -c $< -o $@
#CGP_DATA
$(BUILDDIR)/$(CGP_DATA).o: $(SRCDIR)/$(CGP_DATA).c $(SRCDIR)/$(CGP_DATA).h
$(CC) $(CFLAGS) -c $< -o $@
#COMB_CIRC
$(BUILDDIR)/$(COMB_CIRC).o: $(SRCDIR)/$(COMB_CIRC).c $(SRCDIR)/$(COMB_CIRC).h
$(CC) $(CFLAGS) -c $< -o $@
##########################################################################
.PHONY: subdirs clean
subdirs:
-@mkdir $(TARGETDIR) $(BUILDDIR) || :
clean:
-@del /q /s $(TARGETDIR)
-@del /q /s $(BUILDDIR)