pthreads/{position_race → producer_consumer}/Makefile RENAMED
@@ -1,12 +1,26 @@
1
  APPNAME=$(shell basename $(shell pwd))
2
 
3
- $(APPNAME): $(APPNAME).c
4
- cc -g -Wall -Wextra $(APPNAME).c -o $(APPNAME) -pthread
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  .PHONY: gitignore
7
  gitignore:
8
  echo $(APPNAME) > .gitignore
9
 
10
  .PHONY: clean
11
  clean:
12
  rm -f $(APPNAME)
1
  APPNAME=$(shell basename $(shell pwd))
2
 
3
+ CC=cc
4
+ CXX=g++
5
+ FLAGS=-g -Wall -Wextra
6
+ CFLAGS=$(FLAGS)
7
+ CXXFLAGS=$(FLAGS)
8
+ LIBS=-pthread
9
+ CLIBS=$(LIBS)
10
+ CXXLIBS=$(LIBS)
11
+
12
+ all: $(APPNAME)
13
+
14
+ %: %.c
15
+ $(CC) $(CFLAGS) $^ -o $@ $(CLIBS)
16
+
17
+ %: %.cpp
18
+ $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
19
 
20
  .PHONY: gitignore
21
  gitignore:
22
  echo $(APPNAME) > .gitignore
23
 
24
  .PHONY: clean
25
  clean:
26
  rm -f $(APPNAME)